flowable/flowable-engine · error · IllegalArgumentException

Cannot parse list index

Error message

Cannot parse list index: ${property}

What it means

ListELResolver.coerce converts a String property into a list index; if Integer.parseInt fails it throws IllegalArgumentException 'Cannot parse list index' — the property string is not a valid integer index.

Solutions

  1. Use a numeric index for List access: ${myList[0]}
  2. If string keys are needed, use a Map instead of a List so MapELResolver handles it
  3. Validate/convert the index variable to an integer before building the expression

Example fix

// before
${myList['first']}
// after
${myList[0]}
Defensive patterns

Strategy: validation

Validate before calling

int idx = -1;
if (property instanceof Integer) idx = (Integer) property;
else if (property instanceof String) idx = Integer.parseInt((String) property); // throws early, not via EL
if (idx < 0 || idx >= list.size()) throw new IndexOutOfBoundsException("index=" + idx);

Type guard

Integer asIndex(Object property) {
  if (property instanceof Integer) return (Integer) property;
  if (property instanceof String s && s.matches("\\d+")) return Integer.valueOf(s);
  return null;
}

Try / catch

try {
  resolver.getValue(ctx, list, property);
} catch (IllegalArgumentException e) {
  logger.warn("Bad list index expression: {}", e.getMessage());
}

Prevention

When it happens

Trigger: EL list access with a non-numeric string index, e.g. ${myList['abc']}, where the property is a String but not parseable as an Integer.

Common situations: Using Map-style string keys on a List; variable substitution producing non-numeric index strings; copy-paste of map access syntax into list access.

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/9f18199086202e51. Report an issue: GitHub.

Appendix: source

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

			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 list index: " + property, e);
			}
		}
		throw new IllegalArgumentException("Cannot coerce property to list index: " + property);
	}
}

View on GitHub (pinned to d6d39ce1c6)