{"record":{"id":"b9e715000252f390","repo":"flowable/flowable-engine","slug":"candidate-group-is-null-b9e715","errorCode":null,"errorMessage":"Candidate group is null","messagePattern":"Candidate group 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":622,"sourceCode":"    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) {\n            currentOrQueryObject.involvedGroups = involvedGroups;\n        } else {\n            this.involvedGroups = involvedGroups;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskCandidateGroup(String candidateGroup) {\n        if (candidateGroup == null) {\n            throw new FlowableIllegalArgumentException(\"Candidate group is null\");\n        }\n\n        if (candidateGroups != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both candidateGroup and candidateGroupIn\");\n        }\n\n        if (orActive) {\n            currentOrQueryObject.candidateGroup = candidateGroup;\n        } else {\n            this.candidateGroup = candidateGroup;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQuery taskCandidateOrAssigned(String userIdForCandidateAndAssignee) {\n        if (candidateGroup != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set candidateGroup\");","sourceCodeStart":604,"sourceCodeEnd":640,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L604-L640","documentation":"TaskQueryImpl.taskCandidateGroup() throws this when candidateGroup is null. The candidate group filter needs a concrete group id to query task identity links. Null arguments are rejected at query-build time with FlowableIllegalArgumentException.","triggerScenarios":"Calling taskQuery.taskCandidateGroup(null), typically when the group id comes from a variable, config property, or expression that evaluated to null.","commonSituations":"Process variable holding the candidate group unset; tenant/group resolution returned null; code path refactored so the group is no longer populated.","solutions":["Pass a non-null group id string to taskCandidateGroup().","Null-check before calling and skip the candidate filter when absent.","Resolve the null group id from its upstream source (variable, config, identity provider).","If either group or list may apply, choose taskCandidateGroup or taskCandidateGroupIn consistently and guard both inputs."],"exampleFix":"// before\nTaskQuery query = taskService.createTaskQuery().taskCandidateGroup(groupId);\n// after\nTaskQuery query = taskService.createTaskQuery();\nif (groupId != null) {\n    query = query.taskCandidateGroup(groupId);\n}","handlingStrategy":"validation","validationCode":"if (candidateGroup == null) {\n    throw new IllegalArgumentException(\"candidateGroup must be non-null before taskCandidateGroup()\");\n}\nquery.taskCandidateGroup(candidateGroup);","typeGuard":"boolean isValidCandidateGroup(String g) { return g != null && !g.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.taskCandidateGroup(groupId);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"Invalid candidate group query: {}\", e.getMessage());\n    query = taskService.createTaskQuery();\n}","preventionTips":["Null-check group ids resolved from variables/config before filtering","Build fresh query objects per request","Make candidate-group filtering conditional when the group may be absent","Test query composition with null group inputs"],"tags":["flowable","task-query","null-argument","candidate-group"],"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"}