Activiti/Activiti · error · ActivitiIllegalArgumentException

Priority is null

Error message

Priority is null

What it means

TaskQueryImpl.taskPriority(Integer) throws ActivitiIllegalArgumentException when the priority argument is null. The Activiti query API validates every query parameter eagerly so an incomplete query fails fast in Java instead of producing a broken SQL query at execution time. Pass an explicit integer priority (0-100 per Activiti convention).

Solutions

  1. Ensure the value passed to taskPriority() is a non-null Integer before building the query
  2. If priority filtering is optional, wrap the call: only invoke taskPriority(priority) when priority != null
  3. Use a default value such as taskPriority(priority != null ? priority : 50) if a default is acceptable

Example fix

// before
TaskQuery q = taskService.createTaskQuery().taskPriority(priority);
// after
TaskQuery q = taskService.createTaskQuery();
if (priority != null) {
    q.taskPriority(priority);
}
Defensive patterns

Strategy: validation

Validate before calling

if (priority == null) {
    throw new IllegalArgumentException("priority must be set before calling taskPriority()");
}

Type guard

boolean hasPriority(Integer priority) {
    return priority != null;
}

Try / catch

try {
    query.taskPriority(priority);
} catch (ActivitiIllegalArgumentException e) {
    if (!"Priority is null".equals(e.getMessage())) throw e;
    // handle missing priority: apply default or skip filter
}

Prevention

When it happens

Trigger: Calling taskQuery().taskPriority(null) directly, or passing a null Integer variable that was expected to hold the desired task priority, e.g. taskPriority(configuredPriority) where configuredPriority was never set.

Common situations: Priority read from a config/properties file or database column that is empty; a boxed Integer auto-unboxed from a null field; dynamic query builders forwarding user-supplied filter maps that omit the priority key.

Related errors


AI-assisted analysis of Activiti/Activiti@56435b1a97 (2026-09-09). Data as JSON: /api/errors/507dd4ca6b1cc6d3. Report an issue: GitHub.

Appendix: source

Thrown at activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java:305

        }
        return this;
    }

    public TaskQuery taskDescriptionLikeIgnoreCase(String descriptionLikeIgnoreCase) {
        if (descriptionLikeIgnoreCase == null) {
            throw new ActivitiIllegalArgumentException("Task descriptionLikeIgnoreCase is null");
        }
        if (orActive) {
            currentOrQueryObject.descriptionLikeIgnoreCase = descriptionLikeIgnoreCase.toLowerCase();
        } else {
            this.descriptionLikeIgnoreCase = descriptionLikeIgnoreCase.toLowerCase();
        }
        return this;
    }

    public TaskQuery taskPriority(Integer priority) {
        if (priority == null) {
            throw new ActivitiIllegalArgumentException("Priority is null");
        }
        if (orActive) {
            currentOrQueryObject.priority = priority;
        } else {
            this.priority = priority;
        }
        return this;
    }

    public TaskQuery taskMinPriority(Integer minPriority) {
        if (minPriority == null) {
            throw new ActivitiIllegalArgumentException("Min Priority is null");
        }
        if (orActive) {
            currentOrQueryObject.minPriority = minPriority;
        } else {
            this.minPriority = minPriority;
        }

View on GitHub (pinned to 56435b1a97)