{"record":{"id":"a78a53433f9912c8","repo":"flowable/flowable-engine","slug":"invalid-query-usage-cannot-set-both-taskassigneei-a78a53","errorCode":null,"errorMessage":"Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLikeIgnoreCase","messagePattern":"Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLikeIgnoreCase","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java","lineNumber":396,"sourceCode":"            throw new ActivitiIllegalArgumentException(\"Task assignee list is null\");\n        }\n        if (assigneeIds.isEmpty()) {\n            throw new ActivitiIllegalArgumentException(\"Task assignee list is empty\");\n        }\n        for (String assignee : assigneeIds) {\n            if (assignee == null) {\n                throw new ActivitiIllegalArgumentException(\"None of the given task assignees can be null\");\n            }\n        }\n\n        if (assignee != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both taskAssigneeIds and taskAssignee\");\n        }\n        if (assigneeLike != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLike\");\n        }\n        if (assigneeLikeIgnoreCase != null) {\n            throw new ActivitiIllegalArgumentException(\"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) {\n        if (owner == null) {\n            throw new ActivitiIllegalArgumentException(\"Owner is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.owner = owner;\n        } else {","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java#L378-L414","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove one of the conflicting calls so only taskAssigneeIds is used (or only the assignee/assigneeLike variant)","If you need both exact and list semantics, execute two queries and merge results in application code","Refactor so shared query-building code agrees on one assignee filter style (e.g. always pass a list)","Use .or() blocks deliberately: remember conflicts are checked per query object, so an OR query also cannot mix them in the same block"],"exampleFix":"// before\nquery.taskAssignee(\"kermit\");\nquery.taskAssigneeIds(Arrays.asList(\"1\",\"2\")); // throws\n// after\nquery.taskAssigneeIds(Arrays.asList(\"1\",\"2\"));","handlingStrategy":"validation","validationCode":"if (assigneeIds != null && (assignee != null || assigneeLike != null || assigneeLikeIgnoreCase != null)) {\n    throw new IllegalStateException(\"Use either taskAssigneeIds or the assignee/assigneeLike filters, not both\");\n}\nquery.taskAssigneeIds(assigneeIds);","typeGuard":null,"tryCatchPattern":"try {\n    query.taskAssigneeIds(ids);\n} catch (ActivitiIllegalArgumentException e) {\n    log.warn(\"Conflicting assignee filters: {}\", e.getMessage());\n    query = taskService.createTaskQuery().taskAssigneeIds(ids);\n}","preventionTips":["Decide on one assignee filter style per query before composing filters","When adding taskAssigneeIds to existing code, grep for prior taskAssignee/taskAssigneeLike calls on the same query object","Build queries in a single helper rather than accumulating filters across layers"],"tags":["task-query","illegal-argument","query-builder","activiti"],"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-14T05:17:10.506Z"}