{"record":{"id":"9b2bd492e7e00627","repo":"flowable/flowable-engine","slug":"candidate-group-list-is-null-9b2bd4","errorCode":null,"errorMessage":"Candidate group list is null","messagePattern":"Candidate group list 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":660,"sourceCode":"        if (candidateUser != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both candidateGroup and candidateUser\");\n        }\n\n        if (orActive) {\n            currentOrQueryObject.bothCandidateAndAssigned = true;\n            currentOrQueryObject.userIdForCandidateAndAssignee = userIdForCandidateAndAssignee;\n        } else {\n            this.bothCandidateAndAssigned = true;\n            this.userIdForCandidateAndAssignee = userIdForCandidateAndAssignee;\n        }\n\n        return this;\n    }\n\n    @Override\n    public TaskQuery 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 (orActive) {\n            currentOrQueryObject.candidateGroups = candidateGroups;\n        } else {\n            this.candidateGroups = candidateGroups;\n        }\n        return this;\n    }\n","sourceCodeStart":642,"sourceCodeEnd":678,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L642-L678","documentation":"TaskQueryImpl.taskCandidateGroupIn() throws this when the candidateGroups collection is null. The IN-style filter requires an actual list of group ids to build its query criterion. The fail-fast check prevents malformed SQL and confusing downstream failures.","triggerScenarios":"Calling taskQuery.taskCandidateGroupIn(null), e.g. when the list comes from a method that returned null, an unset field, or a config lookup that missed.","commonSituations":"Identity-provider lookup returned null groups; collection field not initialized; dynamic query composition passing a possibly-null variable.","solutions":["Pass a non-null collection of group ids to taskCandidateGroupIn().","Null-check the collection first and skip the filter (or return empty result) when absent.","Initialize the collection at its source; remember empty lists trigger a separate error.","Fix the upstream code that returns null instead of a populated list."],"exampleFix":"// before\nTaskQuery query = taskService.createTaskQuery().taskCandidateGroupIn(candidateGroups);\n// after\nTaskQuery query = taskService.createTaskQuery();\nif (candidateGroups != null && !candidateGroups.isEmpty()) {\n    query = query.taskCandidateGroupIn(candidateGroups);\n}","handlingStrategy":"validation","validationCode":"if (candidateGroups == null) {\n    throw new IllegalArgumentException(\"candidateGroups must be non-null before taskCandidateGroupIn()\");\n}\nquery.taskCandidateGroupIn(candidateGroups);","typeGuard":"boolean isValidCandidateGroups(Collection<String> g) { return g != null && !g.isEmpty(); }","tryCatchPattern":"try {\n    query.taskCandidateGroupIn(groups);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"Invalid candidate group list: {}\", e.getMessage());\n    query = taskService.createTaskQuery();\n}","preventionTips":["Null-check group lists from identity-provider lookups before filtering","Return empty (never null) collections from resolution code, then guard emptiness too","Skip the filter conditionally when groups are unavailable","Test query builders with null group lists"],"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"}