flowable/flowable-engine · error · FlowableIllegalArgumentException
None of the given process instance ids can be null
Error message
None of the given process instance ids can be null
What it means
TaskQueryImpl.processInstanceIdIn() iterates the collection and rejects any null element, since a null id in the IN list would produce an invalid or always-false SQL predicate. The library throws FlowableIllegalArgumentException naming the offending condition.
Solutions
- Filter nulls before the call: ids.removeIf(Objects::isNull) or ids.stream().filter(Objects::nonNull).collect(toList())
- Fix the producer to never emit null ids
- If filtering empties the list, also handle the empty-collection case first
Example fix
// before
query.processInstanceIdIn(ids); // may contain nulls
// after
List<String> clean = ids.stream().filter(Objects::nonNull).collect(Collectors.toList());
if (clean.isEmpty()) { return Collections.emptyList(); }
query.processInstanceIdIn(clean); Defensive patterns
Strategy: validation
Validate before calling
List<String> clean = processInstanceIds == null
? Collections.emptyList()
: processInstanceIds.stream().filter(Objects::nonNull).collect(Collectors.toList());
if (clean.isEmpty()) { return Collections.emptyList(); }
query.processInstanceIdIn(clean); Type guard
boolean hasNoNullIds(Collection<String> c) { return c != null && c.stream().allMatch(Objects::nonNull); } Try / catch
try {
tasks = taskService.createTaskQuery().processInstanceIdIn(ids).list();
} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {
log.warn("Null element in id list: {}", e.getMessage());
tasks = Collections.emptyList();
} Prevention
- Always .filter(Objects::nonNull) before building IN-clause queries
- Avoid Arrays.asList with possibly-null members; build lists with streams
- Fix producers that emit null ids (e.g. Map.get on absent keys)
When it happens
Trigger: Calling .processInstanceIdIn(list) where the list contains null entries, e.g. from Arrays.asList(a, b) with a null, or from a Map lookup keyed by absent ids.
Common situations: Collecting ids into a size-padded array; streaming results where some rows lack a process instance id.
Related errors
- None of the given task categories can be null
- Process instance id list is null
- Task category list is null
- Assignee is null
- Assignee is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/3b4c6a8fe6bfe4f2.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java:745
if (orActive) {
currentOrQueryObject.processInstanceId = processInstanceId;
} else {
this.processInstanceId = processInstanceId;
}
return this;
}
@Override
public TaskQuery processInstanceIdIn(Collection<String> processInstanceIds) {
if (processInstanceIds == null) {
throw new FlowableIllegalArgumentException("Process instance id list is null");
}
if (processInstanceIds.isEmpty()) {
throw new FlowableIllegalArgumentException("Process instance id list is empty");
}
for (String processInstanceId : processInstanceIds) {
if (processInstanceId == null) {
throw new FlowableIllegalArgumentException("None of the given process instance ids can be null");
}
}
if (orActive) {
currentOrQueryObject.processInstanceIds = processInstanceIds;
} else {
this.processInstanceIds = processInstanceIds;
}
return this;
}
@Override
public TaskQueryImpl withoutProcessInstanceId() {
if (orActive) {
currentOrQueryObject.withoutProcessInstanceId = true;
} else {
this.withoutProcessInstanceId = true;
}View on GitHub (pinned to d6d39ce1c6)