flowable/flowable-engine · error · FlowableIllegalArgumentException
Candidate group list is null
Error message
Candidate group list is null
What it means
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.
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.
Example fix
// before
TaskQuery query = taskService.createTaskQuery().taskCandidateGroupIn(candidateGroups);
// after
TaskQuery query = taskService.createTaskQuery();
if (candidateGroups != null && !candidateGroups.isEmpty()) {
query = query.taskCandidateGroupIn(candidateGroups);
} Defensive patterns
Strategy: validation
Validate before calling
if (candidateGroups == null) {
throw new IllegalArgumentException("candidateGroups must be non-null before taskCandidateGroupIn()");
}
query.taskCandidateGroupIn(candidateGroups); Type guard
boolean isValidCandidateGroups(Collection<String> g) { return g != null && !g.isEmpty(); } Try / catch
try {
query.taskCandidateGroupIn(groups);
} catch (FlowableIllegalArgumentException e) {
logger.warn("Invalid candidate group list: {}", e.getMessage());
query = taskService.createTaskQuery();
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Identity-provider lookup returned null groups; collection field not initialized; dynamic query composition passing a possibly-null variable.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/9b2bd492e7e00627.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java:660
if (candidateUser != null) {
throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both candidateGroup and candidateUser");
}
if (orActive) {
currentOrQueryObject.bothCandidateAndAssigned = true;
currentOrQueryObject.userIdForCandidateAndAssignee = userIdForCandidateAndAssignee;
} else {
this.bothCandidateAndAssigned = true;
this.userIdForCandidateAndAssignee = userIdForCandidateAndAssignee;
}
return this;
}
@Override
public TaskQuery taskCandidateGroupIn(Collection<String> candidateGroups) {
if (candidateGroups == null) {
throw new FlowableIllegalArgumentException("Candidate group list is null");
}
if (candidateGroups.isEmpty()) {
throw new FlowableIllegalArgumentException("Candidate group list is empty");
}
if (candidateGroup != null) {
throw new FlowableIllegalArgumentException("Invalid query usage: cannot set both candidateGroupIn and candidateGroup");
}
if (orActive) {
currentOrQueryObject.candidateGroups = candidateGroups;
} else {
this.candidateGroups = candidateGroups;
}
return this;
}
View on GitHub (pinned to d6d39ce1c6)