{"record":{"id":"1863c71d0bde4a3a","repo":"flowable/flowable-engine","slug":"priority-expression-does-not-resolve-to-a-number-1863c7","errorCode":null,"errorMessage":"Priority expression does not resolve to a number: %s","messagePattern":"Priority expression does not resolve to a number: (.+?)","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java","lineNumber":182,"sourceCode":"                    throw new ActivitiIllegalArgumentException(\"Due date expression does not resolve to a Date or Date string: \" +\n                            activeDueDateExpression.getExpressionText());\n                }\n            }\n        }\n\n        if (activePriorityExpression != null) {\n            final Object priority = activePriorityExpression.getValue(execution);\n            if (priority != null) {\n                if (priority instanceof String) {\n                    try {\n                        task.setPriority(Integer.valueOf((String) priority));\n                    } catch (NumberFormatException e) {\n                        throw new ActivitiIllegalArgumentException(\"Priority does not resolve to a number: \" + priority, e);\n                    }\n                } else if (priority instanceof Number) {\n                    task.setPriority(((Number) priority).intValue());\n                } else {\n                    throw new ActivitiIllegalArgumentException(\"Priority expression does not resolve to a number: \" +\n                            activePriorityExpression.getExpressionText());\n                }\n            }\n        }\n\n        if (activeCategoryExpression != null) {\n            final Object category = activeCategoryExpression.getValue(execution);\n            if (category != null) {\n                if (category instanceof String) {\n                    task.setCategory((String) category);\n                } else {\n                    throw new ActivitiIllegalArgumentException(\"Category expression does not resolve to a string: \" +\n                            activeCategoryExpression.getExpressionText());\n                }\n            }\n        }\n\n        if (activeFormKeyExpression != null) {","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java#L164-L200","documentation":"Thrown when a user task's priority expression resolves to a value that is neither a String nor a Number (e.g. a Boolean, Date, or custom object). The behavior only supports String parseable as integer and Number types; anything else hits this branch. Note the sibling error 'Priority does not resolve to a number' covers unparseable Strings; this one covers wrong types.","triggerScenarios":"activiti:priority expression like ${priorityVar} where the variable holds a Boolean, Date, Map, POJO, or null-adjacent non-numeric object; the expression text is reported in the message for debugging.","commonSituations":"Reusing a variable named 'priority' already holding an unrelated type (e.g. a Date or JSON object) in the process; script tasks setting priority to a non-numeric type; copy-pasted expressions pointing at the wrong variable.","solutions":["Point the priority expression at a variable that is an Integer/Number, e.g. activiti:priority=\"${taskPriority}\" with taskPriority set to an int.","Rename or re-type the colliding variable so 'priority' isn't reused for a Date/object; set a dedicated numeric variable before the user task.","If priority comes from a form, configure the form field as an integer with a sensible default.","Example fix"],"exampleFix":"// before\nexecution.setVariable(\"priority\", new java.util.Date());\n<userTask activiti:priority=\"${priority}\"/>\n// after\nexecution.setVariable(\"taskPriority\", 50);\n<userTask activiti:priority=\"${taskPriority}\"/>","handlingStrategy":"type-guard","validationCode":"Object p = execution.getVariable(\"priority\");\nif (p != null && !(p instanceof Number) && !(p instanceof String)) {\n    throw new IllegalArgumentException(\"priority variable has unsupported type \" + p.getClass() + \"; use Number or numeric String\");\n}","typeGuard":"static boolean isNumericPriority(Object v) {\n    return v == null || v instanceof Number\n        || (v instanceof String && ((String) v).trim().matches(\"-?\\\\d+\"));\n}","tryCatchPattern":"try {\n    taskService.complete(taskId);\n} catch (ActivitiIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Priority expression does not resolve\")) {\n        Object p = runtimeService.getVariable(executionId, \"priority\");\n        log.error(\"priority expression resolved to non-numeric type {}: check expression text in message\",\n            p == null ? null : p.getClass(), e);\n    }\n    throw e;\n}","preventionTips":["Dedicate a numeric variable (e.g. taskPriority) for the priority expression instead of reusing 'priority'.","Check what type the expression actually resolves to; the message includes the expression text for tracing.","Ensure script tasks and integrations set priority as Integer/Number, not Date/Boolean/POJO.","Default priority values in forms so the variable is never an arbitrary object.","Grep process definitions for activiti:priority expressions and audit their variable types."],"tags":["user-task","priority","type-mismatch","expression"],"backgroundTag":"type-mismatch","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"}