{"record":{"id":"4e8844d96a1bfb14","repo":"flowable/flowable-engine","slug":"assignee-is-null-4e8844","errorCode":null,"errorMessage":"Assignee is null","messagePattern":"Assignee is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java","lineNumber":339,"sourceCode":"    }\n\n    @Override\n    public TaskQuery taskMaxPriority(Integer maxPriority) {\n        if (maxPriority == null) {\n            throw new ActivitiIllegalArgumentException(\"Max Priority is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.maxPriority = maxPriority;\n        } else {\n            this.maxPriority = maxPriority;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskAssignee(String assignee) {\n        if (assignee == null) {\n            throw new ActivitiIllegalArgumentException(\"Assignee is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.assignee = assignee;\n        } else {\n            this.assignee = assignee;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskAssigneeLike(String assigneeLike) {\n        if (assigneeLike == null) {\n            throw new ActivitiIllegalArgumentException(\"AssigneeLike is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.assigneeLike = assignee;\n        } else {\n            this.assigneeLike = assigneeLike;","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java#L321-L357","documentation":"Thrown by TaskQueryImpl.taskAssignee(String) when the assignee argument is null. The assignee filter requires an exact user id string; a null would make the filter meaningless, so the query builder rejects it eagerly with ActivitiIllegalArgumentException before the query is ever executed.","triggerScenarios":"Calling taskQuery.taskAssignee(null), or passing a variable holding the current user id that is null because no user is authenticated / the lookup returned nothing.","commonSituations":"Security context has no authenticated principal; UserService.lookup returned null for an unknown user id; a task-list page built a query before the assignee was resolved.","solutions":["Pass a non-null user id string to taskAssignee.","Resolve/verify the user id before building the query; skip the filter (or fail the request) when it is absent.","Add an early check in the controller/service: require an assignee for this query type.","Catch ActivitiIllegalArgumentException and map it to a client error response."],"exampleFix":"// before\nString user = securityContext.getUserId(); // may be null\nquery.taskAssignee(user);\n\n// after\nString user = securityContext.getUserId();\nif (user != null) {\n    query.taskAssignee(user);\n} else {\n    throw new AuthenticationException(\"Assignee required\");\n}","handlingStrategy":"validation","validationCode":"if (assignee != null && !assignee.isEmpty()) {\n    query.taskAssignee(assignee);\n}","typeGuard":"boolean hasAssignee(String s) { return s != null && !s.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.taskAssignee(assignee);\n} catch (ActivitiIllegalArgumentException e) {\n    throw new BadRequestException(\"Assignee filter invalid: \" + e.getMessage());\n}","preventionTips":["Resolve the current user before building the query and require it for assignee-scoped views.","Treat blank strings as 'no filter' and skip the setter.","Never propagate unresolved lookups (null) into query builders."],"tags":["java","flowable","task-query","null-argument","assignee"],"backgroundTag":"null-argument","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"}