# \[FEATURE-13532\]OOB Exception when trying to append to a Flex Repeater's prop.instances

**URL:** <https://forum.inductiveautomation.com/t/feature-13532-oob-exception-when-trying-to-append-to-a-flex-repeaters-prop-instances/26454>\
**Category:** Ignition Early Access\
**Created:** [July 10, 2019, 9:06pm UTC](https://forum.inductiveautomation.com/t/feature-13532-oob-exception-when-trying-to-append-to-a-flex-repeaters-prop-instances/26454 "2019-07-10T21:06:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [July 10, 2019, 9:06pm UTC](https://forum.inductiveautomation.com/t/feature-13532-oob-exception-when-trying-to-append-to-a-flex-repeaters-prop-instances/26454/1 "2019-07-10T21:06:43Z")

</div>

I’m trying to use a message handler to add instances to a Flex Repeater. This is what I have in a message handler on the Flex Repeater:

```auto
self.props.instances.append( {} )
```

Here’s the error I’m getting:

```auto
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 4, in onMessageReceived java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 at com.inductiveautomation.perspective.gateway.script.PropertyTreeScriptWrapper$ArrayWrapper.pyset(PropertyTreeScriptWrapper.java:223) at org.python.core.PyArray.set(PyArray.java:1616) at org.python.core.PyArray.appendUnchecked(PyArray.java:566) at org.python.core.PyArray.array_append(PyArray.java:505) at org.python.core.PyArray$array_append_exposer. __call__ (Unknown Source) at org.python.core.PyObject. __call__ (PyObject.java:484) at org.python.pycode._pyx312.onMessageReceived$1(:4) at org.python.pycode._pyx312.call_function() at org.python.core.PyTableCode.call(PyTableCode.java:171) at org.python.core.PyBaseCode.call(PyBaseCode.java:308) at org.python.core.PyFunction.function ___call__ (PyFunction.java:471) at org.python.core.PyFunction. __call__ (PyFunction.java:466) at org.python.core.PyFunction. __call__ (PyFunction.java:456) at org.python.core.PyFunction. __call__ (PyFunction.java:451) at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:776) at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:894) at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:574) at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:87) at com.inductiveautomation.perspective.gateway.model.MessageHandlerCollection$MessageHandlerImpl$1.lambda$invoke$0(MessageHandlerCollection.java:80) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) java.lang.ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

at org.python.core.Py.JavaError(Py.java:552)

at org.python.core.PyTableCode.call(PyTableCode.java:180)

at org.python.core.PyBaseCode.call(PyBaseCode.java:308)

at org.python.core.PyFunction.function ___call__ (PyFunction.java:471)

at org.python.core.PyFunction. __call__ (PyFunction.java:466)

at org.python.core.PyFunction. __call__ (PyFunction.java:456)

at org.python.core.PyFunction. __call__ (PyFunction.java:451)

at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:776)

at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:894)

at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:574)

at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:87)

at com.inductiveautomation.perspective.gateway.model.MessageHandlerCollection$MessageHandlerImpl$1.lambda$invoke$0(MessageHandlerCollection.java:80)

at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.base/java.lang.Thread.run(Unknown Source)

Caused by: org.python.core.PyException: Traceback (most recent call last): File "", line 4, in onMessageReceived java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 at com.inductiveautomation.perspective.gateway.script.PropertyTreeScriptWrapper$ArrayWrapper.pyset(PropertyTreeScriptWrapper.java:223) at org.python.core.PyArray.set(PyArray.java:1616) at org.python.core.PyArray.appendUnchecked(PyArray.java:566) at org.python.core.PyArray.array_append(PyArray.java:505) at org.python.core.PyArray$array_append_exposer. __call__ (Unknown Source) at org.python.core.PyObject. __call__ (PyObject.java:484) at org.python.pycode._pyx312.onMessageReceived$1(:4) at org.python.pycode._pyx312.call_function() at org.python.core.PyTableCode.call(PyTableCode.java:171) at org.python.core.PyBaseCode.call(PyBaseCode.java:308) at org.python.core.PyFunction.function ___call__ (PyFunction.java:471) at org.python.core.PyFunction. __call__ (PyFunction.java:466) at org.python.core.PyFunction. __call__ (PyFunction.java:456) at org.python.core.PyFunction. __call__ (PyFunction.java:451) at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:776) at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:894) at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:574) at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:87) at com.inductiveautomation.perspective.gateway.model.MessageHandlerCollection$MessageHandlerImpl$1.lambda$invoke$0(MessageHandlerCollection.java:80) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) java.lang.ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

... 17 common frames omitted

Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

at com.inductiveautomation.perspective.gateway.script.PropertyTreeScriptWrapper$ArrayWrapper.pyset(PropertyTreeScriptWrapper.java:223)

at org.python.core.PyArray.set(PyArray.java:1616)

at org.python.core.PyArray.appendUnchecked(PyArray.java:566)

at org.python.core.PyArray.array_append(PyArray.java:505)

at org.python.core.PyArray$array_append_exposer. __call__ (Unknown Source)

at org.python.core.PyObject. __call__ (PyObject.java:484)

at org.python.pycode._pyx312.onMessageReceived$1(:4)

at org.python.pycode._pyx312.call_function()

at org.python.core.PyTableCode.call(PyTableCode.java:171)

... 15 common frames omitted
```

What seems odd is that if I set the instances using

```auto
self.props.instances = [{}]
```

or

```auto
self.props.instances = [{}, {}]
```

everything works as expected. Obviously my end goal is to parameterize these instances, but right now I’m just trying to get the instances adding/deleting. Am I missing something or is this a bug?

---

<div class="post-metadata">

**Author:** ![osolorzano](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/osolorzano/32/6432_2.png) [@osolorzano](https://forum.inductiveautomation.com/u/osolorzano)\
**Post date:** [July 10, 2019, 9:46pm UTC](https://forum.inductiveautomation.com/t/feature-13532-oob-exception-when-trying-to-append-to-a-flex-repeaters-prop-instances/26454/2 "2019-07-10T21:46:04Z")

</div>

We have an existing internal ticket to add this and other python-esque functions to our property editor objects, but right now it currently does not work this way.  
As a workaround, you can get a list from the instances and append to it using something like:

```auto
arr = self.props.instances.tolist()
arr.append({})
self.props.instances = arr

```

---

<div class="post-metadata">

**Author:** ![Subbarao.B](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@Subbarao.B](https://forum.inductiveautomation.com/u/Subbarao.B)\
**Post date:** [October 7, 2021, 5:19pm UTC](https://forum.inductiveautomation.com/t/feature-13532-oob-exception-when-trying-to-append-to-a-flex-repeaters-prop-instances/26454/3 "2021-10-07T17:19:25Z")

</div>

self.props.instances = [{}]  
this is okey ,

but i am passing parameters to flex repeater.  
while adding new  
self.props.instances = [{}] with this i need to pass the parameters.
