flowable/flowable-engine · error · FlowableIllegalArgumentException

Priority expression does not resolve to a number:

Error message

Priority expression does not resolve to a number: 

What it means

The task priority attribute expression evaluated to an object that is neither a String nor a Number (e.g. a Date, Map, or custom bean). Flowable only accepts String parseable as an integer or a Number, so it throws FlowableIllegalArgumentException listing the original expression.

Source

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

            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())) {
            formKeyStringValue = beforeContext.getFormKey();
        }
        
        if (StringUtils.isNotEmpty(formKeyStringValue)) {
            Object formKey = expressionManager.createExpression(formKeyStringValue).getValue(planItemInstanceEntity);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Point the priority expression at a numeric value: ${taskData.priority} instead of ${taskData}.
  2. If it is an enum/bean, expose a numeric accessor and use ${priority.code}.
  3. Convert to Integer/Number when setting the variable.
  4. Catch FlowableIllegalArgumentException and log the expression to find which field it should reference.

Example fix

// before
<cmmn:task priority="${taskConfig}"></cmmn:task>
// after
<cmmn:task priority="${taskConfig.priority}"></cmmn:task>
Defensive patterns

Strategy: type-guard

Validate before calling

Object p = variableScope.getVariable("priority");
if (p != null && !(p instanceof Number) && !(p instanceof String)) throw new IllegalArgumentException("priority must be Number or String");

Type guard

boolean isValidPriorityObject(Object v) { return v == null || v instanceof Number || v instanceof String; }

Try / catch

try {
    // execute plan item
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().contains("Priority expression does not resolve to a number")) {
        log.error("Priority expression resolved to non-numeric type");
    }
}

Prevention

When it happens

Trigger: HumanTaskActivityBehavior.execute -> handlePriority, when the priority expression returns a non-null object that fails both the instanceof String and instanceof Number checks.

Common situations: Priority bound to a complex object (${taskData} where taskData is a Map/bean); variable renamed and now points at an unrelated object; returning an enum instance instead of its numeric code.

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


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