flowable/flowable-engine · error · ActivitiIllegalArgumentException
Invalid query usage: cannot set both taskAssigneeIds and…
Error message
Invalid query usage: cannot set both taskAssigneeIds and taskAssignee
What it means
Thrown by TaskQueryImpl.taskAssigneeIds(List<String>) when the query already has an exact assignee filter set via taskAssignee(String). Assignee filters are mutually exclusive — combining the single-assignee filter with the ids IN-clause would produce contradictory WHERE conditions, so the builder rejects the combination with ActivitiIllegalArgumentException.
Solutions
- Decide on ONE assignee filter: use either taskAssignee or taskAssigneeIds, never both.
- Normalize the input: wrap a single id in a one-element list and always use taskAssigneeIds.
- Track which filter was applied and skip the second one (log or warn about the override).
- Build a fresh TaskQuery per request instead of mutating a shared instance.
- Catch ActivitiIllegalArgumentException and return a 400 explaining the conflicting filters.
Example fix
// before
query.taskAssignee(assignee);
if (assigneeIds != null) {
query.taskAssigneeIds(assigneeIds); // throws
}
// after
if (assigneeIds != null && !assigneeIds.isEmpty()) {
query.taskAssigneeIds(assigneeIds);
} else if (assignee != null) {
query.taskAssignee(assignee);
} Defensive patterns
Strategy: validation
Validate before calling
if (assignee != null && assigneeIds != null) {
throw new BadRequestException("Use either assignee or assigneeIds, not both");
} Type guard
boolean hasConflictingAssigneeFilters(String assignee, List<String> ids) { return assignee != null && ids != null; } Try / catch
try {
query.taskAssigneeIds(assigneeIds);
} catch (ActivitiIllegalArgumentException e) {
throw new BadRequestException("Conflicting assignee filters: " + e.getMessage());
} Prevention
- Pick one assignee filter mode per query; normalize single ids into a one-element list.
- Build a fresh TaskQuery per request; never reuse/mutate shared query objects.
- Reject requests that supply both filter types with a clear 400.
When it happens
Trigger: Calling taskAssignee("kermit") earlier on the same TaskQueryImpl and then taskAssigneeIds(list), typically when filters are applied conditionally from multiple code paths or accumulated on a reused query object.
Common situations: A generic search endpoint that applies both a user filter and a users-list filter from request parameters; reusing a shared query object across requests without resetting state; accumulating OR/AND filters in a loop.
Related errors
- Invalid query usage: cannot set both taskAssigneeIds and…
- Assignee is null
- None of the given task assignees can be null
- Task assignee list is empty
- Task assignee list is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/fa75c94c294ec322.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java:390
return this;
}
@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) {View on GitHub (pinned to d6d39ce1c6)