{"record":{"id":"e539e5e7bf378b17","repo":"flowable/flowable-engine","slug":"cannot-coerce-property-to-list-index-property","errorCode":null,"errorMessage":"Cannot coerce property to list index: ${property}","messagePattern":"Cannot coerce property to list index: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/javax/el/ListELResolver.java","lineNumber":157,"sourceCode":"\n\tprivate static int coerce(Object property) {\n\t\tif (property instanceof Number) {\n\t\t\treturn ((Number) property).intValue();\n\t\t}\n\t\tif (property instanceof Character) {\n\t\t\treturn (Character) property;\n\t\t}\n\t\tif (property instanceof Boolean) {\n\t\t\treturn (Boolean) property ? 1 : 0;\n\t\t}\n\t\tif (property instanceof String) {\n\t\t\ttry {\n\t\t\t\treturn Integer.parseInt((String) property);\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t\tthrow new IllegalArgumentException(\"Cannot parse list index: \" + property, e);\n\t\t\t}\n\t\t}\n\t\tthrow new IllegalArgumentException(\"Cannot coerce property to list index: \" + property);\n\t}\n}\n","sourceCodeStart":139,"sourceCodeEnd":160,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/javax/el/ListELResolver.java#L139-L160","documentation":"ListELResolver.coerceToListIndex converts an EL property (list index) to an integer. If the property is not a Number and not a numeric string parseable by Integer.parseInt, it throws this IllegalArgumentException. This means an expression like myList[foo] referenced a list with a non-numeric index.","triggerScenarios":"Evaluating an EL expression that indexes a List with a property that is neither a Number nor a numeric String, e.g. ${myList[key]} where key is 'abc' or a non-numeric object; the coerce step called from idx fails before the list lookup.","commonSituations":"A process variable used as a list index holds a String like a business key instead of a number; a map was switched to a list in a newer model version so previously-valid string keys now index a list; off-by-one confusion where a developer passes a named key to a list.","solutions":["Ensure the indexed property evaluates to a Number or a numeric String (e.g. pass the numeric index variable)","If lookup-by-key is intended, use a Map instead of a List in the expression, or a different resolver","Validate/normalize the index value in a delegate/bean before the expression runs","Catch IllegalArgumentException from the EL evaluation and report the offending expression to the user"],"exampleFix":"// before\n${myList[orderRef]}   // orderRef = 'ORD-2024-001' -> cannot parse\n// after\n${myList[orderIndex]} // orderIndex = 3 (numeric)","handlingStrategy":"validation","validationCode":"if (!(idx instanceof Number) && !(idx instanceof String && idx.matches(\"\\\\d+\"))) throw new IllegalArgumentException(\"List index must be numeric: \" + idx);","typeGuard":"boolean isListIndex(Object p){ return p instanceof Number || (p instanceof String s && s.matches(\"\\\\d+\")); }","tryCatchPattern":null,"preventionTips":["Only index lists with numeric values","Use Map for keyed lookups","Validate variable types before expression evaluation","Add tests covering every indexed expression"],"tags":[],"backgroundTag":null,"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"}