{"record":{"id":"82afaa54da5587b3","repo":"flowable/flowable-engine","slug":"priority-does-not-resolve-to-a-number","errorCode":null,"errorMessage":"Priority does not resolve to a number: ","messagePattern":"Priority does not resolve to a number: ","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/HumanTaskActivityBehavior.java","lineNumber":282,"sourceCode":"    protected void handlePriority(PlanItemInstanceEntity planItemInstanceEntity, ExpressionManager expressionManager, \n            TaskEntity taskEntity, CreateHumanTaskBeforeContext beforeContext, MigrationContext migrationContext) {\n        \n        String priorityStringValue = null;\n        if (migrationContext != null && migrationContext.getPriority() != null) {\n            priorityStringValue = migrationContext.getPriority();\n            \n        } else if (StringUtils.isNotEmpty(beforeContext.getPriority())) {\n            priorityStringValue = beforeContext.getPriority();\n        }\n        \n        if (StringUtils.isNotEmpty(priorityStringValue)) {\n            Object priority = expressionManager.createExpression(priorityStringValue).getValue(planItemInstanceEntity);\n            if (priority != null) {\n                if (priority instanceof String) {\n                    try {\n                        taskEntity.setPriority(Integer.valueOf((String) priority));\n                    } catch (NumberFormatException e) {\n                        throw new FlowableIllegalArgumentException(\"Priority does not resolve to a number: \" + beforeContext.getPriority(), e);\n                    }\n                } else if (priority instanceof Number) {\n                    taskEntity.setPriority(((Number) priority).intValue());\n                } else {\n                    throw new FlowableIllegalArgumentException(\"Priority expression does not resolve to a number: \" + beforeContext.getPriority());\n                }\n            }\n        }\n    }\n\n    protected void handleFormKey(PlanItemInstanceEntity planItemInstanceEntity, ExpressionManager expressionManager,\n            TaskEntity taskEntity, CreateHumanTaskBeforeContext beforeContext, MigrationContext migrationContext) {\n\n        String formKeyStringValue = null;\n        if (migrationContext != null && migrationContext.getFormKey() != null) {\n            formKeyStringValue = migrationContext.getFormKey();\n            \n        } else if (StringUtils.isNotEmpty(beforeContext.getFormKey())) {","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/HumanTaskActivityBehavior.java#L264-L300","documentation":"The task priority attribute is an expression whose evaluation returned a String that cannot be parsed as an Integer. Flowable accepts a numeric String, a Number, or null; an unparseable String (e.g. \"high\" or \"12a\") makes Integer.valueOf fail and the NumberFormatException is wrapped in FlowableIllegalArgumentException with the original expression text.","triggerScenarios":"HumanTaskActivityBehavior.execute -> handlePriority, when the priority expression resolves to a String and Integer.valueOf((String) priority) throws NumberFormatException.","commonSituations":"Priority expression set to a named level like ${priority} where the variable holds \"high\"/\"urgent\"; a String with spaces or units (\"10 \", \"10pt\"); wrong variable bound that holds a text value.","solutions":["Ensure the priority variable is a numeric String like \"75\" or an Integer/Number object.","Map named levels to numbers before the plan item starts, e.g. ${priority == 'high' ? 100 : 50}.","Fix typos/whitespace in the value so Integer.valueOf can parse it.","Wrap execution in try-catch for FlowableIllegalArgumentException and log beforeContext.getPriority() to identify the bad expression."],"exampleFix":"// before\nexecution.setVariable(\"priority\", \"high\");\n// after\nexecution.setVariable(\"priority\", 100);","handlingStrategy":"validation","validationCode":"Object p = variableScope.getVariable(\"priority\");\nboolean ok = p == null || p instanceof Number || (p instanceof String && ((String) p).trim().matches(\"\\\\d+\"));\nif (!ok) throw new IllegalArgumentException(\"priority must be a number or numeric string\");","typeGuard":"boolean isValidPriority(Object v) { return v == null || v instanceof Number || (v instanceof String && ((String) v).trim().matches(\"\\\\d+\")); }","tryCatchPattern":"try {\n    // start case / execute human task\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Priority does not resolve to a number\")) {\n        log.error(\"Priority expression '{}' unparseable\", e.getMessage());\n    }\n}","preventionTips":["Store priority as Integer, never as named strings like 'high'","Centralize a level->int mapping in your application code","Validate variables with a listener before task creation"],"tags":["cmmn","expression","number-format","priority"],"backgroundTag":"invalid-argument-format","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}