{"record":{"id":"da5d88f395f4d67b","repo":"flowable/flowable-engine","slug":"involved-user-is-null-da5d88","errorCode":null,"errorMessage":"Involved user is null","messagePattern":"Involved user is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java","lineNumber":593,"sourceCode":"    @Override\n    public TaskQueryImpl taskCandidateUser(String candidateUser) {\n        if (candidateUser == null) {\n            throw new FlowableIllegalArgumentException(\"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 FlowableIllegalArgumentException(\"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 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        }\n        if (orActive) {","sourceCodeStart":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L575-L611","documentation":"Flowable throws this FlowableIllegalArgumentException from TaskQueryImpl.taskInvolvedUser() when you pass a null involved user. Query setters validate arguments eagerly so invalid queries fail at build time instead of producing SQL errors or empty results at query time. The query cannot filter by involvement without a user identity.","triggerScenarios":"Calling taskQuery.taskInvolvedUser(null), including when the user id comes from an uninitialized variable, an optional config value, or an expression that resolved to null.","commonSituations":"Variable holding the user id is null because a lookup failed; Spring @Value or process variable not populated; refactoring renamed a field leaving it unset; OR-query branches built dynamically where one branch yields null.","solutions":["Pass a non-null user id string to taskInvolvedUser().","Check the value for null before building the query and skip the involvement filter if absent.","If involvement is optional, build the query conditionally instead of always calling the setter.","Fix the upstream source (config/variable/expression) that produces the null user id."],"exampleFix":"// before\nTaskQuery query = taskService.createTaskQuery().taskInvolvedUser(userId);\n// after\nTaskQuery query = taskService.createTaskQuery();\nif (userId != null) {\n    query = query.taskInvolvedUser(userId);\n}","handlingStrategy":"validation","validationCode":"if (involvedUser == null) {\n    throw new IllegalArgumentException(\"involvedUser must be non-null before taskInvolvedUser()\");\n}\nquery.taskInvolvedUser(involvedUser);","typeGuard":"boolean isValidInvolvedUser(String u) { return u != null && !u.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.taskInvolvedUser(userId);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"Invalid task query: {}\", e.getMessage());\n    query = taskService.createTaskQuery(); // rebuild without the bad filter\n}","preventionTips":["Null-check user ids before applying query filters","Avoid reusing TaskQuery instances across requests","Make optional filters conditional rather than passing null","Add unit tests covering null inputs for query setters"],"tags":["flowable","task-query","null-argument","validation"],"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"}