flowable/flowable-engine · error · FlowableIllegalArgumentException

Invalid query usage: cannot set both taskAssigneeIds and…

Error message

Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLike

What it means

taskAssigneeIds cannot be combined with taskAssigneeLike(String) on the same query. Assignee-ID matching and assignee LIKE (pattern) matching are alternative filter styles, and Flowable forbids mixing them to keep the generated SQL unambiguous.

Solutions

  1. Drop the taskAssigneeLike(...) call when an explicit assignee-ID list is supplied.
  2. Restructure filter assembly so only one assignee filter style is applied per query.
  3. If pattern matching is required, convert the ID list into LIKE patterns instead of passing both.

Example fix

// before
taskQuery.taskAssigneeLike("team-%");
taskQuery.taskAssigneeIds(ids);

// after
if (ids != null && !ids.isEmpty()) {
    taskQuery.taskAssigneeIds(ids);
} else {
    taskQuery.taskAssigneeLike("team-%");
}
Defensive patterns

Strategy: validation

Validate before calling

if (assigneeIds != null && !assigneeIds.isEmpty() && assigneeLike != null) { throw new IllegalStateException("choose assigneeIds or assigneeLike, not both"); }

Type guard

boolean conflict = assigneeLike != null && assigneeIds != null && !assigneeIds.isEmpty();

Try / catch

try {
    applyAssigneeFilters(taskQuery, assigneeLike, assigneeIds);
} catch (FlowableIllegalArgumentException e) {
    if (!e.getMessage().contains("cannot set both taskAssigneeIds and taskAssigneeLike")) throw e;
    logger.error("Conflicting assignee LIKE and ID filters", e);
}

Prevention

When it happens

Trigger: Calling taskQuery.taskAssigneeLike("team-%").taskAssigneeIds(ids) on the same TaskQuery instance, in either order.

Common situations: Combining pattern-based filters from one feature with ID-based filters from another; a generic query builder that applies all non-null criteria regardless of overlap.

Related errors


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

Appendix: source

Thrown at modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java:484

    @Override
    public TaskQuery taskAssigneeIds(Collection<String> assigneeIds) {
        if (assigneeIds == null) {
            throw new FlowableIllegalArgumentException("Task assignee list is null");
        }
        if (assigneeIds.isEmpty()) {
            throw new FlowableIllegalArgumentException("Task assignee list is empty");
        }
        for (String assignee : assigneeIds) {
            if (assignee == null) {
                throw new FlowableIllegalArgumentException("None of the given task assignees can be null");
            }
        }

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

View on GitHub (pinned to d6d39ce1c6)