flowable/flowable-engine · error · FlowableIllegalArgumentException

Priority does not resolve to a number:

Error message

Priority does not resolve to a number: 

What it means

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.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/HumanTaskActivityBehavior.java:282

    protected void handlePriority(PlanItemInstanceEntity planItemInstanceEntity, ExpressionManager expressionManager, 
            TaskEntity taskEntity, CreateHumanTaskBeforeContext beforeContext, MigrationContext migrationContext) {
        
        String priorityStringValue = null;
        if (migrationContext != null && migrationContext.getPriority() != null) {
            priorityStringValue = migrationContext.getPriority();
            
        } else if (StringUtils.isNotEmpty(beforeContext.getPriority())) {
            priorityStringValue = beforeContext.getPriority();
        }
        
        if (StringUtils.isNotEmpty(priorityStringValue)) {
            Object priority = expressionManager.createExpression(priorityStringValue).getValue(planItemInstanceEntity);
            if (priority != null) {
                if (priority instanceof String) {
                    try {
                        taskEntity.setPriority(Integer.valueOf((String) priority));
                    } catch (NumberFormatException e) {
                        throw new FlowableIllegalArgumentException("Priority does not resolve to a number: " + beforeContext.getPriority(), e);
                    }
                } else if (priority instanceof Number) {
                    taskEntity.setPriority(((Number) priority).intValue());
                } else {
                    throw new FlowableIllegalArgumentException("Priority expression does not resolve to a number: " + beforeContext.getPriority());
                }
            }
        }
    }

    protected void handleFormKey(PlanItemInstanceEntity planItemInstanceEntity, ExpressionManager expressionManager,
            TaskEntity taskEntity, CreateHumanTaskBeforeContext beforeContext, MigrationContext migrationContext) {

        String formKeyStringValue = null;
        if (migrationContext != null && migrationContext.getFormKey() != null) {
            formKeyStringValue = migrationContext.getFormKey();
            
        } else if (StringUtils.isNotEmpty(beforeContext.getFormKey())) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Ensure the priority variable is a numeric String like "75" or an Integer/Number object.
  2. Map named levels to numbers before the plan item starts, e.g. ${priority == 'high' ? 100 : 50}.
  3. Fix typos/whitespace in the value so Integer.valueOf can parse it.
  4. Wrap execution in try-catch for FlowableIllegalArgumentException and log beforeContext.getPriority() to identify the bad expression.

Example fix

// before
execution.setVariable("priority", "high");
// after
execution.setVariable("priority", 100);
Defensive patterns

Strategy: validation

Validate before calling

Object p = variableScope.getVariable("priority");
boolean ok = p == null || p instanceof Number || (p instanceof String && ((String) p).trim().matches("\\d+"));
if (!ok) throw new IllegalArgumentException("priority must be a number or numeric string");

Type guard

boolean isValidPriority(Object v) { return v == null || v instanceof Number || (v instanceof String && ((String) v).trim().matches("\\d+")); }

Try / catch

try {
    // start case / execute human task
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().startsWith("Priority does not resolve to a number")) {
        log.error("Priority expression '{}' unparseable", e.getMessage());
    }
}

Prevention

When it happens

Trigger: HumanTaskActivityBehavior.execute -> handlePriority, when the priority expression resolves to a String and Integer.valueOf((String) priority) throws NumberFormatException.

Common situations: 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.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/82afaa54da5587b3. Report an issue: GitHub.