{"record":{"id":"92192e42e3f99a4c","repo":"flowable/flowable-engine","slug":"invalid-query-usage-cannot-set-both-taskassigneei-92192e","errorCode":null,"errorMessage":"Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLike","messagePattern":"Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLike","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java","lineNumber":393,"sourceCode":"    @Override\n    public TaskQuery taskAssigneeIds(List<String> assigneeIds) {\n        if (assigneeIds == null) {\n            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        }","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java#L375-L411","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Choose one assignee matching mode: either the LIKE pattern or the explicit id list.","If both inputs arrive, prefer the explicit ids and drop the pattern (or vice versa) explicitly.","Clear/rebuild the query when switching between search modes.","Validate request parameters so at most one assignee filter type is accepted, rejecting otherwise with 400."],"exampleFix":"// before\nquery.taskAssigneeLike(pattern);\nquery.taskAssigneeIds(ids); // throws\n\n// after\nif (ids != null && !ids.isEmpty()) {\n    query.taskAssigneeIds(ids);\n} else if (pattern != null) {\n    query.taskAssigneeLike(pattern);\n}","handlingStrategy":"validation","validationCode":"if (pattern != null && assigneeIds != null) {\n    throw new BadRequestException(\"Use either assigneeLike or assigneeIds, not both\");\n}","typeGuard":"boolean hasConflictingLikeAndIds(String pattern, List<String> ids) { return pattern != null && ids != null; }","tryCatchPattern":"try {\n    query.taskAssigneeIds(assigneeIds);\n} catch (ActivitiIllegalArgumentException e) {\n    throw new BadRequestException(\"Conflicting assignee filters: \" + e.getMessage());\n}","preventionTips":["Choose one assignee matching mode (LIKE pattern vs explicit ids) per query.","Define precedence in the request-mapping layer and drop the losing filter explicitly.","Validate that at most one assignee filter parameter is present in incoming requests."],"tags":["java","flowable","task-query","conflicting-filters","assignee"],"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"}