{"record":{"id":"8d65643b5c1f7cc8","repo":"flowable/flowable-engine","slug":"invalid-query-usage-cannot-set-both-taskassigneei-8d6564","errorCode":null,"errorMessage":"Invalid query usage: cannot set both taskAssigneeIds and taskAssignee","messagePattern":"Invalid query usage: cannot set both taskAssigneeIds and taskAssignee","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java","lineNumber":481,"sourceCode":"        return this;\n    }\n\n    @Override\n    public TaskQuery taskAssigneeIds(Collection<String> assigneeIds) {\n        if (assigneeIds == null) {\n            throw new FlowableIllegalArgumentException(\"Task assignee list is null\");\n        }\n        if (assigneeIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Task assignee list is empty\");\n        }\n        for (String assignee : assigneeIds) {\n            if (assignee == null) {\n                throw new FlowableIllegalArgumentException(\"None of the given task assignees can be null\");\n            }\n        }\n\n        if (assignee != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both taskAssigneeIds and taskAssignee\");\n        }\n        if (assigneeLike != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLike\");\n        }\n        if (assigneeLikeIgnoreCase != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLikeIgnoreCase\");\n        }\n\n        if (orActive) {\n            currentOrQueryObject.assigneeIds = assigneeIds;\n        } else {\n            this.assigneeIds = assigneeIds;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskOwner(String owner) {","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L463-L499","documentation":"taskAssigneeIds refuses to be combined with taskAssignee(String) on the same query object. The two filters are alternative ways to constrain by assignee, and mixing them would create ambiguous query semantics. Flowable enforces the mutual exclusion with this error.","triggerScenarios":"Calling taskQuery.taskAssignee(\"alice\").taskAssigneeIds(ids) (or setting them in either order) on the same TaskQuery instance — often when query criteria are assembled dynamically and different code paths each set an assignee constraint.","commonSituations":"Composing a query from multiple optional filter objects that both set assignee criteria; migrating code from single-assignee to multi-assignee queries while leaving the old call in place; an OR-block or shared query reused across features.","solutions":["Remove the redundant taskAssignee(...) call and use only taskAssigneeIds for assignee filtering.","Make filter composition mutually exclusive: if an assignee-ID list exists, skip the single-assignee criteria.","Use separate query objects when both filters are genuinely needed in different branches."],"exampleFix":"// before\ntaskQuery.taskAssignee(assignee);\ntaskQuery.taskAssigneeIds(assigneeIds);\n\n// after\nif (assigneeIds != null && !assigneeIds.isEmpty()) {\n    taskQuery.taskAssigneeIds(assigneeIds);\n} else if (assignee != null) {\n    taskQuery.taskAssignee(assignee);\n}","handlingStrategy":"validation","validationCode":"if (assigneeIds != null && !assigneeIds.isEmpty() && assignee != null) { throw new IllegalStateException(\"choose one assignee filter\"); }","typeGuard":"boolean conflict = assignee != null && assigneeIds != null && !assigneeIds.isEmpty();","tryCatchPattern":"try {\n    applyAssigneeFilters(taskQuery, assignee, assigneeIds);\n} catch (FlowableIllegalArgumentException e) {\n    if (!e.getMessage().contains(\"cannot set both taskAssigneeIds and taskAssignee\")) throw e;\n    logger.error(\"Query builder set conflicting assignee filters\", e);\n}","preventionTips":["Route all assignee filtering through one method that enforces exclusivity.","When migrating to taskAssigneeIds, delete old taskAssignee calls.","Document in the query-builder API which criteria are mutually exclusive."],"tags":["flowable","task-query","mutually-exclusive","query-usage"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}