Activiti/Activiti · error · ActivitiIllegalArgumentException
Process instance id list is empty
Error message
Process instance id list is empty
What it means
HistoricTaskInstanceQueryImpl.processInstanceIdIn() throws ActivitiIllegalArgumentException when the processInstanceIds list is empty. Like the null case, an empty list cannot produce a valid IN clause and would misleadingly return no tasks, so the library treats it as a programming error.
Solutions
- Ensure the list contains at least one process instance id
- Return an empty result early when the list is empty instead of executing the query
- Drop the processInstanceIdIn() filter when no id restriction is intended
- Validate the upstream id-collection step so it cannot silently produce an empty list
Example fix
// before
query.processInstanceIdIn(collectProcessInstanceIds()); // empty -> throws
// after
List<String> pids = collectProcessInstanceIds();
if (pids.isEmpty()) {
return Collections.emptyList();
}
query.processInstanceIdIn(pids); Defensive patterns
Strategy: validation
Validate before calling
if (processInstanceIds == null || processInstanceIds.isEmpty()) {
return Collections.emptyList();
}
taskQuery.processInstanceIdIn(processInstanceIds); Type guard
boolean isPopulatedList(java.util.List<?> l) { return l != null && !l.isEmpty(); } Try / catch
try {
query.processInstanceIdIn(pids);
} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {
if (!e.getMessage().contains("Process instance id list is empty")) throw e;
return Collections.emptyList();
} Prevention
- Return early with an empty result when the id list is empty
- Also guard list elements: null elements in the list are rejected separately
- Test dynamic query paths with empty input lists
When it happens
Trigger: Calling processInstanceIdIn(new ArrayList<>()) or passing a list emptied by filtering; piping in ids from a previous query that returned zero rows.
Common situations: Batch correlation flows where the source query matched nothing; dynamic filters from user selection UIs with nothing selected; pagination logic draining the list before the query runs.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Task assignee list is empty
- Assignee is null
- AssigneeLike is null
- assigneeLikeIgnoreCase is null
- Candidate group list is empty
AI-assisted analysis of Activiti/Activiti@56435b1a97 (2026-09-09).
Data as JSON: /api/errors/e304136c704f9ee0.
Report an issue: GitHub.
Appendix: source
Thrown at activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java:175
return tasks;
}
public HistoricTaskInstanceQueryImpl processInstanceId(String processInstanceId) {
if (inOrStatement) {
this.currentOrQueryObject.processInstanceId = processInstanceId;
} else {
this.processInstanceId = processInstanceId;
}
return this;
}
@Override
public HistoricTaskInstanceQueryImpl 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 (inOrStatement) {
this.currentOrQueryObject.processInstanceIds = processInstanceIds;
} else {
this.processInstanceIds = processInstanceIds;
}
return this;
}
public HistoricTaskInstanceQueryImpl processInstanceBusinessKey(String processInstanceBusinessKey) {
if (inOrStatement) {
this.currentOrQueryObject.processInstanceBusinessKey = processInstanceBusinessKey;View on GitHub (pinned to 56435b1a97)