{"record":{"id":"487fe0dd385b96f0","repo":"flowable/flowable-engine","slug":"candidate-group-list-is-null-487fe0","errorCode":null,"errorMessage":"Candidate group list is null","messagePattern":"Candidate group list is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":1099,"sourceCode":"            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\");\n        }\n\n        if (candidateGroups.isEmpty()) {\n            throw new ActivitiIllegalArgumentException(\"Candidate group list is empty\");\n        }\n\n        if (candidateGroup != null) {\n            throw new ActivitiIllegalArgumentException(\"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":1081,"sourceCodeEnd":1117,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java#L1081-L1117","documentation":"HistoricTaskInstanceQueryImpl.taskCandidateGroupIn(List<String>) rejects a null list with ActivitiIllegalArgumentException. Passing null means no group criterion could be built, so the engine fails fast rather than issuing a malformed query.","triggerScenarios":"Calling taskCandidateGroupIn(null), e.g. when the group list variable was never initialized or a lookup returned null.","commonSituations":"Group list fetched from an external source (LDAP, DB, config) that returned null on failure; uninitialized field in a filter DTO passed straight through.","solutions":["Initialize the list (Collections.emptyList() if you also handle the empty case) before calling, or skip the call when null.","Make the upstream resolver return an empty list instead of null.","If the groups are mandatory, fail in your own layer with a clearer error before touching the query."],"exampleFix":"// before\nList<String> groups = fetchGroups(tenantId); // may return null\nquery.taskCandidateGroupIn(groups); // throws when null\n\n// after\nList<String> groups = fetchGroups(tenantId);\nif (groups != null && !groups.isEmpty()) {\n    query.taskCandidateGroupIn(groups);\n}","handlingStrategy":"validation","validationCode":"// Java\nif (candidateGroups != null && !candidateGroups.isEmpty()) {\n    query.taskCandidateGroupIn(candidateGroups);\n}","typeGuard":null,"tryCatchPattern":"try {\n    query.taskCandidateGroupIn(groups);\n} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {\n    // skip filter or propagate a clearer domain error\n}","preventionTips":["Make list-returning resolvers return empty lists, never null.","Null-check externally sourced group lists at the boundary.","Initialize filter DTO list fields with empty collections."],"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"}