{"record":{"id":"28224ebcbca29390","repo":"flowable/flowable-engine","slug":"involved-user-is-null-28224e","errorCode":null,"errorMessage":"involved user is null","messagePattern":"involved user is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":1944,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Candidate group list is empty\");\n        }\n\n        if (candidateGroup != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both candidateGroupIn and candidateGroup\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.candidateGroups = candidateGroups;\n        } else {\n            this.candidateGroups = candidateGroups;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery taskInvolvedUser(String involvedUser) {\n        if (involvedUser == null) {\n            throw new FlowableIllegalArgumentException(\"involved user is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.involvedUser = involvedUser;\n        } else {\n            this.involvedUser = involvedUser;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery taskInvolvedGroups(Collection<String> involvedGroups) {\n        if (involvedGroups == null) {\n            throw new FlowableIllegalArgumentException(\"Involved groups are null\");\n        }\n        if (involvedGroups.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Involved groups are empty\");\n        }","sourceCodeStart":1926,"sourceCodeEnd":1962,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java#L1926-L1962","documentation":"taskInvolvedUser(String) throws FlowableIllegalArgumentException when the involvedUser argument is null. Flowable validates that required identity filters are non-null at call time. The involved-user filter matches tasks where the given user appears in identity links (participant, assignee, etc.).","triggerScenarios":"Calling taskInvolvedUser(null) — commonly an unresolved variable from task.getAssignee() (null for unassigned tasks), a missing session user, or an optional REST parameter forwarded unchecked.","commonSituations":"Passing the current user id from a security context that is null for anonymous/unauthenticated requests; querying involvement of a user derived from an unassigned task.","solutions":["Pass a non-null user id; verify the security-context/user variable before the call.","Skip taskInvolvedUser() when no user filter is intended.","For unassigned tasks use taskUnassigned() instead of deriving a user from a null assignee."],"exampleFix":"// before\nString userId = securityService.getCurrentUser();\nquery.taskInvolvedUser(userId); // throws when anonymous\n\n// after\nString userId = securityService.getCurrentUser();\nif (userId != null) {\n    query.taskInvolvedUser(userId);\n}","handlingStrategy":"validation","validationCode":"if (involvedUser != null && !involvedUser.isEmpty()) {\n    historicTaskInstanceQuery.taskInvolvedUser(involvedUser);\n}","typeGuard":"boolean isValidUser(String userId) {\n    return userId != null && !userId.trim().isEmpty();\n}","tryCatchPattern":"try {\n    query.taskInvolvedUser(userId);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Invalid involvedUser filter: {}\", e.getMessage());\n}","preventionTips":["Never forward a null assignee (unassigned task) as an involved-user filter; use taskUnassigned() instead.","Handle unauthenticated requests: skip user filters when the security context yields null.","Validate optional REST parameters before applying them to the query."],"tags":["flowable","query-validation","null-argument","task-query"],"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"}