flowable/flowable-engine · error · ActivitiIllegalArgumentException
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(List<String>) iterates the given ids and throws ActivitiIllegalArgumentException if any individual element is null. The engine builds a SQL IN clause from the list, and a null element cannot be bound as a valid process instance id.
Solutions
- Filter out null (and blank) ids before passing the list: ids.removeIf(Objects::isNull) or build a new filtered list.
- Validate each id is non-null/non-blank at the boundary where the list is created and fail with a precise message about which entry is bad.
- Catch ActivitiIllegalArgumentException around query construction and report the invalid id list to the caller.
Example fix
// before
taskQuery.processInstanceIdIn(ids); // ids may contain nulls
// after
List<String> cleanIds = ids.stream()
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (!cleanIds.isEmpty()) {
taskQuery.processInstanceIdIn(cleanIds);
} Defensive patterns
Strategy: validation
Validate before calling
List<String> cleanIds = ids == null ? Collections.emptyList()
: ids.stream().filter(Objects::nonNull).collect(Collectors.toList());
if (!cleanIds.isEmpty()) {
taskQuery.processInstanceIdIn(cleanIds);
} Type guard
boolean hasNoNullEntries(List<String> ids) { return ids != null && ids.stream().allMatch(Objects::nonNull); } Try / catch
try {
return taskQuery.processInstanceIdIn(ids).list();
} catch (ActivitiIllegalArgumentException e) {
log.warn("Null entry in process instance ids: {}", e.getMessage());
throw new BadRequestException("All process instance ids must be non-null");
} Prevention
- Drop nulls (and blanks) when collecting ids from Map lookups or joins
- Validate list contents, not just the list itself
- Reject null entries at the deserialization boundary
When it happens
Trigger: Calling taskQuery.processInstanceIdIn(Arrays.asList("id1", null)) or passing a collection produced by a mapping step that inserted nulls (e.g. Map lookups that missed, or a results array with placeholder nulls).
Common situations: Joining ids from external systems where some lookups failed and nulls were kept instead of dropped; deserializing JSON arrays that contain null entries.
Related errors
- Candidate group list is empty
- Candidate group list is null
- Process category list is empty
- Process category list is null
- Process instance id list is empty
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/00d4900a95657989.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java:627
if (orActive) {
currentOrQueryObject.processInstanceId = processInstanceId;
} else {
this.processInstanceId = processInstanceId;
}
return this;
}
@Override
public TaskQuery processInstanceIdIn(List<String> processInstanceIds) {
if (processInstanceIds == null) {
throw new ActivitiIllegalArgumentException("Process instance id list is null");
}
if (processInstanceIds.isEmpty()) {
throw new ActivitiIllegalArgumentException("Process instance id list is empty");
}
for (String processInstanceId : processInstanceIds) {
if (processInstanceId == null) {
throw new ActivitiIllegalArgumentException("None of the given process instance ids can be null");
}
}
if (orActive) {
currentOrQueryObject.processInstanceIds = processInstanceIds;
} else {
this.processInstanceIds = processInstanceIds;
}
return this;
}
@Override
public TaskQueryImpl processInstanceBusinessKey(String processInstanceBusinessKey) {
if (orActive) {
currentOrQueryObject.processInstanceBusinessKey = processInstanceBusinessKey;
} else {
this.processInstanceBusinessKey = processInstanceBusinessKey;
}View on GitHub (pinned to d6d39ce1c6)