{"record":{"id":"e74933505e75dbf1","repo":"flowable/flowable-engine","slug":"priority-does-not-resolve-to-a-number-s","errorCode":null,"errorMessage":"Priority does not resolve to a number: %s","messagePattern":"Priority 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":177,"sourceCode":"                            .getProcessEngineConfiguration()\n                            .getBusinessCalendarManager()\n                            .getBusinessCalendar(taskDefinition.getBusinessCalendarNameExpression().getValue(execution).toString());\n                    task.setDueDate(businessCalendar.resolveDuedate((String) dueDate));\n                } else {\n                    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());","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java#L159-L195","documentation":"Thrown when a user task's priority expression resolves to a non-null String that cannot be parsed as an Integer. The behavior parses String values with Integer.valueOf and wraps NumberFormatException in this ActivitiIllegalArgumentException. The value was a String but not a valid integer.","triggerScenarios":"activiti:priority expression like ${priorityVar} where priorityVar is a String such as \"high\", \"75.5\", \"100 \", or any non-integer text; Integer.valueOf throws NumberFormatException and it is rethrown as this error.","commonSituations":"Form/JSON variables storing priority as words (\"high\"/\"low\"), decimal numbers, or values with whitespace/sign issues; mapping a UI enum label straight into the priority expression.","solutions":["Store the priority as an integer (1-100 per convention) in the process variable, e.g. execution.setVariable(\"priority\", 75).","If the variable is a string, convert with a valid integer value first: Integer.parseInt(trimmed) or use an expression like ${integer(priority)} if a converter is available.","Map enum labels (\"high\"/\"low\") to numbers before the user task, e.g. in a service task or via a start-form default.","Example fix"],"exampleFix":"// before\nexecution.setVariable(\"priority\", \"high\");\n<userTask activiti:priority=\"${priority}\"/>\n// after\nexecution.setVariable(\"priority\", 90);\n<userTask activiti:priority=\"${priority}\"/>","handlingStrategy":"validation","validationCode":"Object p = execution.getVariable(\"priority\");\nif (p instanceof String && !((String) p).trim().matches(\"-?\\\\d+\")) {\n    throw new IllegalArgumentException(\"priority must be an integer string, got: \" + p);\n}\nif (p != null && !(p instanceof Number) && !(p instanceof String)) {\n    throw new IllegalArgumentException(\"priority must be Number or numeric String\");\n}","typeGuard":"static boolean isValidPriority(Object v) {\n    if (v == null) return true;\n    if (v instanceof Number) return true;\n    if (v instanceof String) {\n        try { Integer.parseInt(((String) v).trim()); return true; }\n        catch (NumberFormatException e) { return false; }\n    }\n    return false;\n}","tryCatchPattern":"try {\n    taskService.complete(taskId);\n} catch (ActivitiIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Priority does not resolve to a number\")) {\n        Object p = runtimeService.getVariable(executionId, \"priority\");\n        log.error(\"priority='{}' is not an integer; map labels to ints before the task\", p);\n    }\n    throw e;\n}","preventionTips":["Store priority as an Integer in process variables (Activiti convention: 1-100).","Map textual labels like \"high\"/\"low\" to numeric values in a preceding service task or form.","Never put decimal or whitespace-padded strings into priority expressions.","Validate form field types so priority fields are integer inputs.","Sanitize variables imported from external systems/JSON before using them in priority expressions."],"tags":["user-task","priority","number-format","validation"],"backgroundTag":"invalid-argument-value","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"}