flowable/flowable-engine · error · PropertyNotFoundException
PropertyNotFoundException
Error message
PropertyNotFoundException
What it means
ArrayELResolver.checkBounds throws PropertyNotFoundException when an EL expression indexes into an array with an out-of-range index (negative or >= array length). This is the EL resolver's way of surfacing an ArrayIndexOutOfBoundsException as a standard EL exception during getType, setValue, or isReadOnly resolution.
Source
Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/javax/el/ArrayELResolver.java:306
@Override
public Class<?> getCommonPropertyType(ELContext context, Object base) {
return isResolvable(base) ? Integer.class : null;
}
/**
* Test whether the given base should be resolved by this ELResolver.
*
* @param base
* The bean to analyze.
* @return base != null && base.getClass().isArray()
*/
private final boolean isResolvable(Object base) {
return base != null && base.getClass().isArray();
}
private static void checkBounds(Object base, int idx) {
if (idx < 0 || idx >= Array.getLength(base)) {
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);View on GitHub (pinned to d6d39ce1c6)
Solutions
- Log/inspect the array length at evaluation time and fix the expression's index to be within 0..length-1.
- Guard the expression with a bounds check, e.g. ${myArray.length > 5 ? myArray[5] : ''}, or use a List instead of an array (ListELResolver returns null for out-of-range instead of throwing).
- If the index comes from a variable, validate/clamp it before evaluation.
Example fix
// before
String first = (String) engine.eval("${items[0]}", itemsIsEmptyContext);
// after
String expr = items.length > 0 ? "${items[0]}" : "${null}"; // or guard in the EL expression itself Defensive patterns
Strategy: validation
Validate before calling
if (idx < 0 || idx >= arr.length) throw new IllegalArgumentException("index " + idx + " out of bounds for array of length " + arr.length); Try / catch
try { value = resolver.getValue(ctx, base, idx); } catch (PropertyNotFoundException e) { /* fallback to default */ } Prevention
- Bounds-check indexes before building EL expressions
- Prefer List over array when indexes may be dynamic (ListELResolver tolerates out-of-range)
- Guard with ${arr.length > n ? arr[n] : fallback}
When it happens
Trigger: Evaluating an EL expression like ${myArray[5]} where myArray has fewer than 6 elements, or a negative index such as ${myArray[-1]}, or a coerced String index like 'idx' that resolves outside 0..length-1.
Common situations: Expressions referencing array positions computed from loop counters or list sizes in process/BPMN expressions; off-by-one indexing; arrays shrunk by refactoring while templates still reference old fixed indexes.
Related errors
- Cannot parse array index:
- Cannot coerce property to array index:
- error.coerce.type
- ' + token.getImage() + '
- error.identifier.method.notamethod
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/18d88720b2261135.
Report an issue: GitHub.