{"record":{"id":"e543b95912df844a","repo":"flowable/flowable-engine","slug":"cannot-parse-array-index-e543b9","errorCode":null,"errorMessage":"Cannot parse array index: ","messagePattern":"Cannot parse array index: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/javax/el/ArrayELResolver.java","lineNumber":324,"sourceCode":"\t\t\tthrow new PropertyNotFoundException(new ArrayIndexOutOfBoundsException(idx).getMessage());\n\t\t}\n\t}\n\n\tprivate static int coerce(Object property) {\n\t\tif (property instanceof Number) {\n\t\t\treturn ((Number) property).intValue();\n\t\t}\n\t\tif (property instanceof Character) {\n\t\t\treturn (Character) property;\n\t\t}\n\t\tif (property instanceof Boolean) {\n\t\t\treturn (Boolean) property ? 1 : 0;\n\t\t}\n\t\tif (property instanceof String) {\n\t\t\ttry {\n\t\t\t\treturn Integer.parseInt((String) property);\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t\tthrow new IllegalArgumentException(\"Cannot parse array index: \" + property, e);\n\t\t\t}\n\t\t}\n\n\t\tthrow new IllegalArgumentException(\"Cannot coerce property to array index: \" + property);\n\t}\n}\n","sourceCodeStart":306,"sourceCodeEnd":331,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/javax/el/ArrayELResolver.java#L306-L331","documentation":"ArrayELResolver.coerce throws IllegalArgumentException when an array index supplied as a String in an EL expression cannot be parsed as an integer. The original NumberFormatException is preserved as the cause.","triggerScenarios":"Evaluating ${myArray[abc]} or ${myArray[someStringVariable]} where the property coerces to a non-numeric String like 'first' or 'id-12'.","commonSituations":"Copy-pasting map-style access ${data[key]} against an array instead of a Map; typos in variable names causing the index variable name to be treated as a literal string.","solutions":["Use a numeric index in the expression, or resolve a numeric variable as the index.","If keyed access is needed, switch the base object from an array to a Map so the property is used as a key, not an index.","Check that the index variable in your expression context actually holds a number, not a String with non-digit characters."],"exampleFix":"// before\nengine.eval(\"${items[first]}\")\n// after\nengine.eval(\"${items[0]}\")  // or move 'first' into the context as an Integer","handlingStrategy":"validation","validationCode":"if (indexProp instanceof String s && !s.matches(\"\\\\d+\")) throw new IllegalArgumentException(\"EL array index must be numeric: \" + s);","typeGuard":null,"tryCatchPattern":"try { resolver.getValue(ctx, base, prop); } catch (IllegalArgumentException e) { /* log bad index literal */ }","preventionTips":["Only use integer literals or numeric variables as array indexes in EL","Use Map instead of array for keyed lookups","Verify index variables in the EL context hold numbers"],"tags":["el","array","parsing","expression-language"],"backgroundTag":"invalid-argument-format","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}