{"record":{"id":"48643c920f1451c8","repo":"flowable/flowable-engine","slug":"candidate-group-is-null","errorCode":null,"errorMessage":"Candidate group is null","messagePattern":"Candidate group 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":1904,"sourceCode":"\n    @Override\n    public HistoricTaskInstanceQuery taskCandidateUser(String candidateUser) {\n        if (candidateUser == null) {\n            throw new FlowableIllegalArgumentException(\"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 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 (inOrStatement) {\n            this.currentOrQueryObject.candidateGroup = candidateGroup;\n        } else {\n            this.candidateGroup = candidateGroup;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery taskCandidateGroupIn(Collection<String> candidateGroups) {\n        if (candidateGroups == null) {\n            throw new FlowableIllegalArgumentException(\"Candidate group list is null\");","sourceCodeStart":1886,"sourceCodeEnd":1922,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java#L1886-L1922","documentation":"HistoricTaskInstanceQueryImpl.taskCandidateGroup(String) throws FlowableIllegalArgumentException when the candidateGroup argument is null. Query setter methods in Flowable validate their required arguments immediately so invalid queries surface at call time. It also enforces that candidateGroup and candidateGroupIn are not both set.","triggerScenarios":"Calling taskCandidateGroup(null) — usually a null group variable from an unassigned candidate group on the task definition, or an optional method/REST parameter forwarded without a check.","commonSituations":"Querying by a group that comes from task.getCandidateGroup() on tasks with no group candidate; config-driven filters where the group key was absent; dynamically built queries with optional group criteria.","solutions":["Ensure a non-empty group id string is passed; check for null/emptiness before calling.","Skip the taskCandidateGroup() call when no group filter is needed.","If several groups may apply, use taskCandidateGroupIn(Collection) instead."],"exampleFix":"// before\nquery.taskCandidateGroup(groupName);\n\n// after\nif (groupName != null) {\n    query.taskCandidateGroup(groupName);\n}","handlingStrategy":"validation","validationCode":"if (candidateGroup == null || candidateGroup.isEmpty()) {\n    throw new IllegalArgumentException(\"candidateGroup must be a non-empty group id\");\n}\nhistoricTaskInstanceQuery.taskCandidateGroup(candidateGroup);","typeGuard":"boolean isValidGroup(String groupId) {\n    return groupId != null && !groupId.trim().isEmpty();\n}","tryCatchPattern":"try {\n    query.taskCandidateGroup(candidateGroup);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Invalid candidateGroup filter: {}\", e.getMessage());\n    query = taskService.createHistoricTaskInstanceQuery(); // rebuild clean\n}","preventionTips":["Validate group ids coming from configuration or request payloads before querying.","Use taskCandidateGroupIn() when the number of groups may vary.","Never chain taskCandidateGroup() and taskCandidateGroupIn() on the same query object."],"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"}