flowable/flowable-engine · error · ActivitiIllegalArgumentException
Priority does not resolve to a number: %s
Error message
Priority does not resolve to a number: %s
What it means
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.
Source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java:177
.getProcessEngineConfiguration()
.getBusinessCalendarManager()
.getBusinessCalendar(taskDefinition.getBusinessCalendarNameExpression().getValue(execution).toString());
task.setDueDate(businessCalendar.resolveDuedate((String) dueDate));
} else {
throw new ActivitiIllegalArgumentException("Due date expression does not resolve to a Date or Date string: " +
activeDueDateExpression.getExpressionText());
}
}
}
if (activePriorityExpression != null) {
final Object priority = activePriorityExpression.getValue(execution);
if (priority != null) {
if (priority instanceof String) {
try {
task.setPriority(Integer.valueOf((String) priority));
} catch (NumberFormatException e) {
throw new ActivitiIllegalArgumentException("Priority does not resolve to a number: " + priority, e);
}
} else if (priority instanceof Number) {
task.setPriority(((Number) priority).intValue());
} else {
throw new ActivitiIllegalArgumentException("Priority expression does not resolve to a number: " +
activePriorityExpression.getExpressionText());
}
}
}
if (activeCategoryExpression != null) {
final Object category = activeCategoryExpression.getValue(execution);
if (category != null) {
if (category instanceof String) {
task.setCategory((String) category);
} else {
throw new ActivitiIllegalArgumentException("Category expression does not resolve to a string: " +
activeCategoryExpression.getExpressionText());View on GitHub (pinned to d6d39ce1c6)
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
Example fix
// before
execution.setVariable("priority", "high");
<userTask activiti:priority="${priority}"/>
// after
execution.setVariable("priority", 90);
<userTask activiti:priority="${priority}"/> Defensive patterns
Strategy: validation
Validate before calling
Object p = execution.getVariable("priority");
if (p instanceof String && !((String) p).trim().matches("-?\\d+")) {
throw new IllegalArgumentException("priority must be an integer string, got: " + p);
}
if (p != null && !(p instanceof Number) && !(p instanceof String)) {
throw new IllegalArgumentException("priority must be Number or numeric String");
} Type guard
static boolean isValidPriority(Object v) {
if (v == null) return true;
if (v instanceof Number) return true;
if (v instanceof String) {
try { Integer.parseInt(((String) v).trim()); return true; }
catch (NumberFormatException e) { return false; }
}
return false;
} Try / catch
try {
taskService.complete(taskId);
} catch (ActivitiIllegalArgumentException e) {
if (e.getMessage().startsWith("Priority does not resolve to a number")) {
Object p = runtimeService.getVariable(executionId, "priority");
log.error("priority='{}' is not an integer; map labels to ints before the task", p);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Priority does not resolve to a number: + priority
- Priority does not resolve to a number:
- Priority expression does not resolve to a number: + activeTa
- Due date expression does not resolve to a Date or Date strin
- Priority expression does not resolve to a number: %s
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/e74933505e75dbf1.
Report an issue: GitHub.