flowable/flowable-engine · error · ActivitiIllegalArgumentException

Invalid query usage: cannot set both taskAssigneeIds and…

Error message

Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLike

What it means

Thrown by TaskQueryImpl.taskAssigneeIds(List<String>) when a LIKE-based assignee filter (taskAssigneeLike) is already set on the query. Exact id list matching and pattern matching on assignee are mutually exclusive filters; combining them would yield contradictory WHERE clauses, so the builder raises ActivitiIllegalArgumentException.

Solutions

  1. Choose one assignee matching mode: either the LIKE pattern or the explicit id list.
  2. If both inputs arrive, prefer the explicit ids and drop the pattern (or vice versa) explicitly.
  3. Clear/rebuild the query when switching between search modes.
  4. Validate request parameters so at most one assignee filter type is accepted, rejecting otherwise with 400.

Example fix

// before
query.taskAssigneeLike(pattern);
query.taskAssigneeIds(ids); // throws

// after
if (ids != null && !ids.isEmpty()) {
    query.taskAssigneeIds(ids);
} else if (pattern != null) {
    query.taskAssigneeLike(pattern);
}
Defensive patterns

Strategy: validation

Validate before calling

if (pattern != null && assigneeIds != null) {
    throw new BadRequestException("Use either assigneeLike or assigneeIds, not both");
}

Type guard

boolean hasConflictingLikeAndIds(String pattern, List<String> ids) { return pattern != null && ids != null; }

Try / catch

try {
    query.taskAssigneeIds(assigneeIds);
} catch (ActivitiIllegalArgumentException e) {
    throw new BadRequestException("Conflicting assignee filters: " + e.getMessage());
}

Prevention

When it happens

Trigger: Calling taskAssigneeLike("%mit") before taskAssigneeIds(list) on the same query object, e.g. when a search endpoint maps both a pattern search and an explicit user list from the request.

Common situations: Advanced-search UIs sending both 'assigneeSearch' (pattern) and 'assigneeIds'; layered filter assembly where different services each add their own assignee condition; reused query objects retaining state from previous use.

Related errors


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

Appendix: source

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

    @Override
    public TaskQuery taskAssigneeIds(List<String> assigneeIds) {
        if (assigneeIds == null) {
            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");
        }

View on GitHub (pinned to d6d39ce1c6)