flowable/flowable-engine · error · IllegalArgumentException

Cannot parse array index:

Error message

Cannot parse array index: 

What it means

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.

Source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/javax/el/ArrayELResolver.java:324

			throw new PropertyNotFoundException(new ArrayIndexOutOfBoundsException(idx).getMessage());
		}
	}

	private static int coerce(Object property) {
		if (property instanceof Number) {
			return ((Number) property).intValue();
		}
		if (property instanceof Character) {
			return (Character) property;
		}
		if (property instanceof Boolean) {
			return (Boolean) property ? 1 : 0;
		}
		if (property instanceof String) {
			try {
				return Integer.parseInt((String) property);
			} catch (NumberFormatException e) {
				throw new IllegalArgumentException("Cannot parse array index: " + property, e);
			}
		}

		throw new IllegalArgumentException("Cannot coerce property to array index: " + property);
	}
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Use a numeric index in the expression, or resolve a numeric variable as the index.
  2. 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.
  3. Check that the index variable in your expression context actually holds a number, not a String with non-digit characters.

Example fix

// before
engine.eval("${items[first]}")
// after
engine.eval("${items[0]}")  // or move 'first' into the context as an Integer
Defensive patterns

Strategy: validation

Validate before calling

if (indexProp instanceof String s && !s.matches("\\d+")) throw new IllegalArgumentException("EL array index must be numeric: " + s);

Try / catch

try { resolver.getValue(ctx, base, prop); } catch (IllegalArgumentException e) { /* log bad index literal */ }

Prevention

When it happens

Trigger: Evaluating ${myArray[abc]} or ${myArray[someStringVariable]} where the property coerces to a non-numeric String like 'first' or 'id-12'.

Common situations: 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.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/e543b95912df844a. Report an issue: GitHub.