{"record":{"id":"621687ce01190041","repo":"flowable/flowable-engine","slug":"candidate-group-is-null-621687","errorCode":null,"errorMessage":"Candidate group is null","messagePattern":"Candidate group is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":1081,"sourceCode":"\n    @Override\n    public HistoricTaskInstanceQuery taskCandidateUser(String candidateUser) {\n        if (candidateUser == null) {\n            throw new ActivitiIllegalArgumentException(\"Candidate user is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.candidateUser = candidateUser;\n        } else {\n            this.candidateUser = candidateUser;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery 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        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.candidateGroup = candidateGroup;\n        } else {\n            this.candidateGroup = candidateGroup;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery taskCandidateGroupIn(List<String> candidateGroups) {\n        if (candidateGroups == null) {\n            throw new ActivitiIllegalArgumentException(\"Candidate group list is null\");","sourceCodeStart":1063,"sourceCodeEnd":1099,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java#L1063-L1099","documentation":"HistoricTaskInstanceQueryImpl.taskCandidateGroup(String) rejects a null candidateGroup with ActivitiIllegalArgumentException. Like the other setters here it validates eagerly before mutating query state.","triggerScenarios":"Calling taskCandidateGroup(null), typically when the group id comes from an unset configuration value, request parameter, or lookup that returned null.","commonSituations":"Tenant/group resolution code that fails to resolve a group and still builds the query; optional group filter forwarded as null from an API layer.","solutions":["Guard with if (candidateGroup != null) before calling taskCandidateGroup and omit the filter otherwise.","Resolve the group earlier and abort the query build with a domain-specific error if the group is mandatory.","Use taskCandidateGroupIn(list) with a populated list if the filter may come from several groups."],"exampleFix":"// before\nString group = resolveGroup(tenantId);\nquery.taskCandidateGroup(group); // throws when unresolved\n\n// after\nString group = resolveGroup(tenantId);\nif (group != null) {\n    query.taskCandidateGroup(group);\n}","handlingStrategy":"validation","validationCode":"// Java\nif (candidateGroup != null && !candidateGroup.isEmpty()) {\n    query.taskCandidateGroup(candidateGroup);\n}","typeGuard":null,"tryCatchPattern":"try {\n    query.taskCandidateGroup(group);\n} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {\n    logger.warn(\"No candidate group resolved; skipping group filter\");\n}","preventionTips":["Resolve group ids with a non-null default policy before query building.","Log/skip rather than pass through unresolved group lookups.","Consider taskCandidateGroupIn for multi-group scenarios."],"tags":["query-builder","null-argument","flowable","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-14T05:17:10.506Z"}