{"record":{"id":"75b0ea7899a82158","repo":"flowable/flowable-engine","slug":"involved-user-is-null-75b0ea","errorCode":null,"errorMessage":"Involved user is null","messagePattern":"Involved user is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java","lineNumber":501,"sourceCode":"    @Override\n    public TaskQueryImpl taskCandidateUser(String candidateUser) {\n        if (candidateUser == null) {\n            throw new ActivitiIllegalArgumentException(\"Candidate user is null\");\n        }\n\n        if (orActive) {\n            currentOrQueryObject.candidateUser = candidateUser;\n        } else {\n            this.candidateUser = candidateUser;\n        }\n\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskInvolvedUser(String involvedUser) {\n        if (involvedUser == null) {\n            throw new ActivitiIllegalArgumentException(\"Involved user is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.involvedUser = involvedUser;\n        } else {\n            this.involvedUser = involvedUser;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskCandidateGroup(String candidateGroup) {\n        if (candidateGroup == null) {\n            throw new ActivitiIllegalArgumentException(\"Candidate group is null\");\n        }\n\n        if (candidateGroups != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set both candidateGroup and candidateGroupIn\");\n        }","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java#L483-L519","documentation":"taskInvolvedUser(String involvedUser) throws ActivitiIllegalArgumentException(\"Involved user is null\") when the involved-user id is null. Involvement is stored via identity links, and the query needs a concrete user id to filter on. A null argument is rejected at builder time.","triggerScenarios":"Calling taskQuery.taskInvolvedUser(null), e.g. when the involved user id comes from an optional variable, request parameter, or lookup that was null.","commonSituations":"Passing a variable that was never set on the process; REST query endpoints where the involvedUser parameter was omitted; user directory lookups returning null for deleted users.","solutions":["Null-check the involved user and add the filter only when present","Have the API/DTO layer require the parameter explicitly when filtering by involvement is intended","Clean up or guard lookups of users that may have been deleted"],"exampleFix":"// before\nquery.taskInvolvedUser(request.getParameter(\"involvedUser\")); // null if param absent\n// after\nString involvedUser = request.getParameter(\"involvedUser\");\nif (involvedUser != null) { query.taskInvolvedUser(involvedUser); }","handlingStrategy":"validation","validationCode":"if (involvedUser == null) {\n    throw new IllegalArgumentException(\"involvedUser is required when filtering by involvement\");\n}\nquery.taskInvolvedUser(involvedUser);","typeGuard":"boolean hasInvolvedUser(String userId) { return userId != null && !userId.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.taskInvolvedUser(involvedUser);\n} catch (ActivitiIllegalArgumentException e) {\n    log.warn(\"Skipping involved-user filter: {}\", e.getMessage());\n}","preventionTips":["Make involvedUser a required query parameter at the API layer when that filter is intended","Null-check process variables before using them as filter values","Verify user ids against the identity service before querying"],"tags":["task-query","null-argument","query-builder","activiti"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}