flowable/flowable-engine · error · ActivitiIllegalArgumentException

Max Priority is null

Error message

Max Priority is null

What it means

Thrown by TaskQueryImpl.taskMaxPriority(Integer) when the maxPriority argument is null. Like all Flowable/Activiti 5 query setters, it validates input up front: a null max priority is not a meaningful filter and would corrupt the generated query, so ActivitiIllegalArgumentException is raised immediately.

Source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java:326

    }

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

    @Override
    public TaskQuery taskMaxPriority(Integer maxPriority) {
        if (maxPriority == null) {
            throw new ActivitiIllegalArgumentException("Max Priority is null");
        }
        if (orActive) {
            currentOrQueryObject.maxPriority = maxPriority;
        } else {
            this.maxPriority = maxPriority;
        }
        return this;
    }

    @Override
    public TaskQueryImpl taskAssignee(String assignee) {
        if (assignee == null) {
            throw new ActivitiIllegalArgumentException("Assignee is null");
        }
        if (orActive) {
            currentOrQueryObject.assignee = assignee;
        } else {
            this.assignee = assignee;

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass a concrete Integer (e.g. taskMaxPriority(100)).
  2. Guard the call: only invoke taskMaxPriority when the value is non-null.
  3. Initialize the filter field with a default such as Integer.MAX_VALUE when it represents 'no upper bound'.
  4. Validate/normalize the incoming DTO before building the query.

Example fix

// before
query.taskMaxPriority(filter.getMaxPriority());

// after
if (filter.getMaxPriority() != null) {
    query.taskMaxPriority(filter.getMaxPriority());
}
Defensive patterns

Strategy: validation

Validate before calling

if (maxPriority != null) {
    query.taskMaxPriority(maxPriority);
}

Type guard

boolean hasMaxPriority(Integer v) { return v != null; }

Try / catch

try {
    query.taskMaxPriority(maxPriority);
} catch (ActivitiIllegalArgumentException e) {
    throw new BadRequestException("Invalid maxPriority: " + e.getMessage());
}

Prevention

When it happens

Trigger: Calling taskQuery.taskMaxPriority(null), or feeding a null Integer obtained from an unset request parameter, missing map key, or incomplete filter object into taskMaxPriority.

Common situations: Optional 'maxPriority' REST parameter not sent by the client; filter objects deserialized from JSON where the field is absent; copying values between query objects where the source field was never set.

Related errors


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