{"record":{"id":"d74ce7a0ef34aba7","repo":"flowable/flowable-engine","slug":"candidate-group-is-null-d74ce7","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/TaskQueryImpl.java","lineNumber":514,"sourceCode":"    }\n\n    @Override\n    public TaskQueryImpl taskInvolvedUser(String involvedUser) {\n        if (involvedUser == null) {\n            throw new ActivitiIllegalArgumentException(\"Involved user is null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.involvedUser = involvedUser;\n        } else {\n            this.involvedUser = involvedUser;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl 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 (orActive) {\n            currentOrQueryObject.candidateGroup = candidateGroup;\n        } else {\n            this.candidateGroup = candidateGroup;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQuery taskCandidateOrAssigned(String userIdForCandidateAndAssignee) {\n        if (candidateGroup != null) {\n            throw new ActivitiIllegalArgumentException(\"Invalid query usage: cannot set candidateGroup\");","sourceCodeStart":496,"sourceCodeEnd":532,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java#L496-L532","documentation":"taskCandidateGroup(String candidateGroup) throws ActivitiIllegalArgumentException(\"Candidate group is null\") when the candidate group id is null. The builder needs a concrete group id for the candidate-group identity-link filter. It also rejects combining this method with taskCandidateGroupIn, which is the sibling error at the same call site.","triggerScenarios":"Calling taskQuery.taskCandidateGroup(null); usually the group id derives from user group lookups or configuration that resolved to null.","commonSituations":"User has no groups so a first-group lookup returns null; tenant/authorization configuration missing a group mapping; refactoring where a group list was split and a null element slipped in.","solutions":["Only call taskCandidateGroup when the group id is non-null; otherwise skip the filter or use taskCandidateGroupIn with a validated list","Ensure the user-to-groups resolution always returns a usable value or an empty list you branch on","Validate configuration that supplies default candidate groups at startup"],"exampleFix":"// before\nquery.taskCandidateGroup(groups.get(0)); // IndexOutOfBounds/null risk\n// after\nif (groups != null && !groups.isEmpty()) {\n    if (groups.size() == 1) { query.taskCandidateGroup(groups.get(0)); }\n    else { query.taskCandidateGroupIn(groups); }\n}","handlingStrategy":"type-guard","validationCode":"if (candidateGroup == null) {\n    throw new IllegalArgumentException(\"candidateGroup must not be null\");\n}\nquery.taskCandidateGroup(candidateGroup);","typeGuard":"boolean hasCandidateGroup(String group) { return group != null && !group.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.taskCandidateGroup(group);\n} catch (ActivitiIllegalArgumentException e) {\n    log.warn(\"Skipping candidate-group filter: {}\", e.getMessage());\n}","preventionTips":["Fall back to taskCandidateGroupIn(emptyList) semantics by skipping the filter when no group resolves","Resolve user groups first and branch on empty vs single vs multiple","Validate group configuration at application startup"],"tags":["task-query","null-argument","candidate-group","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-18T11:17:12.947Z"}