{"record":{"id":"56af907377b3f87a","repo":"flowable/flowable-engine","slug":"cannot-parse-array-index","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/el/JsonNodeELResolver.java","lineNumber":367,"sourceCode":"        } else if (value != null) {\n            node.set(index, value.toString());\n\n        } else {\n            node.setNull(index);\n        }\n\n        context.setPropertyResolved(true);\n    }\n\n    protected int toIndex(Object property) {\n        int index;\n        if (property instanceof Number) {\n            index = ((Number) property).intValue();\n        } else if (property instanceof String) {\n            try {\n                index = Integer.valueOf((String) property);\n            } catch (NumberFormatException e) {\n                throw new IllegalArgumentException(\"Cannot parse array index: \" + property, e);\n            }\n        } else {\n            throw new IllegalArgumentException(\"Cannot coerce property to array index: \" + property);\n        }\n\n        return index;\n    }\n\n    /**\n     * Test whether the given base should be resolved by this ELResolver.\n     * \n     * @param base\n     *            The bean to analyze.\n     * @return base != null\n     */\n    private final boolean isResolvable(Object base) {\n        return JsonUtil.isJsonNode(base);\n    }","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JsonNodeELResolver.java#L349-L385","documentation":"JsonNodeELResolver.toIndex throws IllegalArgumentException('Cannot parse array index: ' + property) when the property used to address a JSON array element is a String that is not a valid integer. Array access requires a numeric index; a non-numeric string cannot be coerced.","triggerScenarios":"Evaluating an expression like ${jsonVar[\"abc\"]} or ${jsonVar[someStringVar]} where the target base is a JSON array and the property string does not parse via Integer.valueOf.","commonSituations":"Typos in expressions using quoted keys on arrays instead of objects; passing a user-supplied or variable string as an index without validating it is numeric; mixing up object property and array index syntax.","solutions":["Use a numeric index (literal or integer variable) when the base is a JSON array","Validate with a regex or Integer.parseInt before using a variable as an index","If key-based access is intended, make the base a JSON object, not an array"],"exampleFix":"// before\n${jsonArray[\"first\"]}  // IllegalArgumentException\n// after\n${jsonArray[0]}","handlingStrategy":"validation","validationCode":"boolean isValidArrayIndex = s != null && s.matches(\"\\\\d+\");","typeGuard":"boolean isValidArrayIndex(Object p) { return p instanceof Number || (p instanceof String s && s.matches(\"\\\\d+\")); }","tryCatchPattern":"try { expr.getValue(ctx); } catch (FlowableException e) { if (e.getCause() instanceof IllegalArgumentException iae && iae.getMessage().startsWith(\"Cannot parse array index\")) { throw new IllegalArgumentException(\"Use a numeric index for JSON arrays\", iae); } throw e; }","preventionTips":["Only index JSON arrays with integers; use objects for key access","Validate variable-based indexes are numeric before building expressions","Prefer numeric literal indexes in BPMN expressions"],"tags":["java","el","array-index","parse"],"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-18T11:17:12.947Z"}