flowable/flowable-engine · error · ActivitiIllegalArgumentException
Priority expression does not resolve to a number: %s
Error message
Priority expression does not resolve to a number: %s
What it means
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.
Source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java:182
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());
}
}
}
if (activeFormKeyExpression != null) {View on GitHub (pinned to d6d39ce1c6)
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
Example fix
// before
execution.setVariable("priority", new java.util.Date());
<userTask activiti:priority="${priority}"/>
// after
execution.setVariable("taskPriority", 50);
<userTask activiti:priority="${taskPriority}"/> Defensive patterns
Strategy: type-guard
Validate before calling
Object p = execution.getVariable("priority");
if (p != null && !(p instanceof Number) && !(p instanceof String)) {
throw new IllegalArgumentException("priority variable has unsupported type " + p.getClass() + "; use Number or numeric String");
} Type guard
static boolean isNumericPriority(Object v) {
return v == null || v instanceof Number
|| (v instanceof String && ((String) v).trim().matches("-?\\d+"));
} Try / catch
try {
taskService.complete(taskId);
} catch (ActivitiIllegalArgumentException e) {
if (e.getMessage().startsWith("Priority expression does not resolve")) {
Object p = runtimeService.getVariable(executionId, "priority");
log.error("priority expression resolved to non-numeric type {}: check expression text in message",
p == null ? null : p.getClass(), e);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Priority expression does not resolve to a number: + activeTa
- Priority expression does not resolve to a number:
- Due date expression does not resolve to a Date, Instant, Loc
- Priority does not resolve to a number: + priority
- Category expression does not resolve to a string: %s
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/1863c71d0bde4a3a.
Report an issue: GitHub.