flowable/flowable-engine · error · IllegalArgumentException
Cannot parse array index:
Error message
Cannot parse array index:
What it means
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.
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
Example fix
// before
${jsonArray["first"]} // IllegalArgumentException
// after
${jsonArray[0]} Defensive patterns
Strategy: validation
Validate before calling
boolean isValidArrayIndex = s != null && s.matches("\\d+"); Type guard
boolean isValidArrayIndex(Object p) { return p instanceof Number || (p instanceof String s && s.matches("\\d+")); } Try / catch
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; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Cannot coerce property to array index:
- error.property.method.access
- error.property.method.invocation
- error.property.method.notfound
- error.property.method.returntype
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/56af907377b3f87a.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JsonNodeELResolver.java:367
} else if (value != null) {
node.set(index, value.toString());
} else {
node.setNull(index);
}
context.setPropertyResolved(true);
}
protected int toIndex(Object property) {
int index;
if (property instanceof Number) {
index = ((Number) property).intValue();
} else if (property instanceof String) {
try {
index = Integer.valueOf((String) property);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Cannot parse array index: " + property, e);
}
} else {
throw new IllegalArgumentException("Cannot coerce property to array index: " + property);
}
return index;
}
/**
* Test whether the given base should be resolved by this ELResolver.
*
* @param base
* The bean to analyze.
* @return base != null
*/
private final boolean isResolvable(Object base) {
return JsonUtil.isJsonNode(base);
}View on GitHub (pinned to d6d39ce1c6)