{"record":{"id":"9a5aea5a06f69b5f","repo":"flowable/flowable-engine","slug":"candidate-group-list-is-null","errorCode":null,"errorMessage":"Candidate group list is null","messagePattern":"Candidate group list 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":1922,"sourceCode":"            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\");\n        }\n\n        if (candidateGroups.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Candidate group list is empty\");\n        }\n\n        if (candidateGroup != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both candidateGroupIn and candidateGroup\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.candidateGroups = candidateGroups;\n        } else {\n            this.candidateGroups = candidateGroups;\n        }\n        return this;\n    }\n","sourceCodeStart":1904,"sourceCodeEnd":1940,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java#L1904-L1940","documentation":"taskCandidateGroupIn(Collection<String>) throws FlowableIllegalArgumentException when the candidateGroups collection argument is null. Flowable validates required collection arguments before assigning them to the query. This check runs before the empty-list and mutual-exclusion checks.","triggerScenarios":"Calling taskCandidateGroupIn(null) — e.g. a groups field that was never initialized, or a nullable result of a role-lookup API passed directly in.","commonSituations":"Group list obtained from user/role providers that can return null; deserialized request bodies missing the 'groups' field; map lookups with a missing key returning null.","solutions":["Pass a non-null collection of group ids; initialize or default it (e.g. Collections.emptyList()) before the call.","Skip the filter when the group list is not available.","Check GroupsProvider results for null before forwarding to the query."],"exampleFix":"// before\nquery.taskCandidateGroupIn(userGroups);\n\n// after\nif (userGroups != null && !userGroups.isEmpty()) {\n    query.taskCandidateGroupIn(userGroups);\n}","handlingStrategy":"validation","validationCode":"if (candidateGroups == null) {\n    throw new IllegalArgumentException(\"candidateGroups must not be null; pass a non-empty list or skip the filter\");\n}\nif (!candidateGroups.isEmpty()) {\n    historicTaskInstanceQuery.taskCandidateGroupIn(candidateGroups);\n}","typeGuard":"boolean isNonEmptyGroups(Collection<String> groups) {\n    return groups != null && !groups.isEmpty();\n}","tryCatchPattern":"try {\n    query.taskCandidateGroupIn(candidateGroups);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Invalid candidateGroupIn filter: {}\", e.getMessage());\n}","preventionTips":["Default null group collections to an empty list at the service boundary and skip the filter.","Null-check results from group/role providers before querying.","Validate request DTOs so the groups field is always present."],"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"}