flowable/flowable-engine · error · ActivitiIllegalArgumentException

Invalid query usage: cannot set both taskAssigneeIds and tas

Error message

Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLikeIgnoreCase

What it means

The Flowable (Activiti 5) task query API throws ActivitiIllegalArgumentException when taskAssigneeIds() is called after a conflicting assignee filter (taskAssignee, taskAssigneeLike, or taskAssigneeLikeIgnoreCase) has already been set on the same query object. The query builder only allows one style of assignee filtering at a time; mixing them would produce an ambiguous SQL condition. It fails fast at query-construction time rather than producing wrong results.

Source

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

            throw new ActivitiIllegalArgumentException("Task assignee list is null");
        }
        if (assigneeIds.isEmpty()) {
            throw new ActivitiIllegalArgumentException("Task assignee list is empty");
        }
        for (String assignee : assigneeIds) {
            if (assignee == null) {
                throw new ActivitiIllegalArgumentException("None of the given task assignees can be null");
            }
        }

        if (assignee != null) {
            throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskAssigneeIds and taskAssignee");
        }
        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 {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Remove one of the conflicting calls so only taskAssigneeIds is used (or only the assignee/assigneeLike variant)
  2. If you need both exact and list semantics, execute two queries and merge results in application code
  3. Refactor so shared query-building code agrees on one assignee filter style (e.g. always pass a list)
  4. Use .or() blocks deliberately: remember conflicts are checked per query object, so an OR query also cannot mix them in the same block

Example fix

// before
query.taskAssignee("kermit");
query.taskAssigneeIds(Arrays.asList("1","2")); // throws
// after
query.taskAssigneeIds(Arrays.asList("1","2"));
Defensive patterns

Strategy: validation

Validate before calling

if (assigneeIds != null && (assignee != null || assigneeLike != null || assigneeLikeIgnoreCase != null)) {
    throw new IllegalStateException("Use either taskAssigneeIds or the assignee/assigneeLike filters, not both");
}
query.taskAssigneeIds(assigneeIds);

Try / catch

try {
    query.taskAssigneeIds(ids);
} catch (ActivitiIllegalArgumentException e) {
    log.warn("Conflicting assignee filters: {}", e.getMessage());
    query = taskService.createTaskQuery().taskAssigneeIds(ids);
}

Prevention

When it happens

Trigger: Calling taskAssigneeIds(...) on a TaskQuery instance that already has taskAssignee(...), taskAssigneeLike(...), or taskAssigneeLikeIgnoreCase(...) set (in the same query or in the same OR block). The check runs inside the taskAssigneeIds setter at TaskQueryImpl.java:396.

Common situations: Building a query where a base filter from shared code uses taskAssignee and an additional layer adds taskAssigneeIds; copy-pasted query builders; migrating code that replaced assignee matching with an IDs list but left the old filter in place.

Related errors


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