flowable/flowable-engine · error · ActivitiIllegalArgumentException

Owner is null

Error message

Owner is null

What it means

taskOwner(String owner) validates its argument and throws ActivitiIllegalArgumentException when the passed owner is null. The query API requires an actual owner string to build the T.OWNER_ filter; a null would silently produce a broken or meaningless WHERE clause. Pass a non-null user id, or do not call the method at all.

Source

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

        if (assigneeLike != null) {
            throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLike");
        }
        if (assigneeLikeIgnoreCase != null) {
            throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLikeIgnoreCase");
        }

        if (orActive) {
            currentOrQueryObject.assigneeIds = assigneeIds;
        } else {
            this.assigneeIds = assigneeIds;
        }
        return this;
    }

    @Override
    public TaskQueryImpl taskOwner(String owner) {
        if (owner == null) {
            throw new ActivitiIllegalArgumentException("Owner is null");
        }
        if (orActive) {
            currentOrQueryObject.owner = owner;
        } else {
            this.owner = owner;
        }
        return this;
    }

    @Override
    public TaskQueryImpl taskOwnerLike(String ownerLike) {
        if (ownerLike == null) {
            throw new ActivitiIllegalArgumentException("Owner is null");
        }
        if (orActive) {
            currentOrQueryObject.ownerLike = ownerLike;
        } else {
            this.ownerLike = ownerLike;

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Ensure the owner value is non-null before building the query (skip the filter if null)
  2. Default the value to a sentinel such as an empty string only if your data model actually stores that
  3. Fix the upstream source (variable, form, REST body) so the owner is always provided when this query runs

Example fix

// before
String owner = (String) execution.getVariable("owner");
query.taskOwner(owner); // throws if variable missing
// after
String owner = (String) execution.getVariable("owner");
if (owner != null) { query.taskOwner(owner); }
Defensive patterns

Strategy: type-guard

Validate before calling

Objects.requireNonNull(owner, "owner must not be null");
query.taskOwner(owner);

Type guard

boolean hasOwner(String owner) { return owner != null && !owner.trim().isEmpty(); }

Try / catch

try {
    query.taskOwner(owner);
} catch (ActivitiIllegalArgumentException e) {
    log.warn("Skipping owner filter: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling taskQuery.taskOwner(null), typically when the owner value comes from a variable, request parameter, or optional lookup that resolved to null.

Common situations: Passing a process variable that was never initialized; wiring a null from a form field or REST payload; using a user lookup that returned null for an unknown user id.

Related errors


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