flowable/flowable-engine · error · FlowableIllegalArgumentException
Provided batch types must be provided and not empty
Error message
Provided batch types must be provided and not empty
What it means
BatchQueryImpl.batchTypes() throws FlowableIllegalArgumentException when the collection is null OR empty. Unlike single-value setters, an empty list is also rejected because it would translate to a meaningless SQL IN () clause; omit the call entirely to query all types.
Source
Thrown at modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchQueryImpl.java:86
throw new FlowableIllegalArgumentException("Provided batch id is null");
}
this.id = batchId;
return this;
}
@Override
public BatchQuery batchType(String batchType) {
if (batchType == null) {
throw new FlowableIllegalArgumentException("Provided batch type is null");
}
this.batchType = batchType;
return this;
}
@Override
public BatchQuery batchTypes(Collection<String> batchTypes) {
if (batchTypes == null || batchTypes.isEmpty()) {
throw new FlowableIllegalArgumentException("Provided batch types must be provided and not empty");
}
this.batchTypes = batchTypes;
return this;
}
@Override
public BatchQuery searchKey(String searchKey) {
if (searchKey == null) {
throw new FlowableIllegalArgumentException("Provided search key is null");
}
this.searchKey = searchKey;
return this;
}
@Override
public BatchQuery searchKey2(String searchKey) {
if (searchKey == null) {
throw new FlowableIllegalArgumentException("Provided search key is null");View on GitHub (pinned to d6d39ce1c6)
Solutions
- Pass a non-empty collection of batch types
- Skip the .batchTypes(...) call when the collection is null or empty (means: no type filter)
- Add a size check before forwarding user/config-driven lists
Example fix
// before
query.batchTypes(selectedTypes); // may be null or empty
// after
if (selectedTypes != null && !selectedTypes.isEmpty()) {
query.batchTypes(selectedTypes);
} Defensive patterns
Strategy: validation
Validate before calling
if (batchTypes == null || batchTypes.isEmpty()) {
// no filter requested: do not call batchTypes()
} else {
query.batchTypes(batchTypes);
} Type guard
boolean isNonEmpty(Collection<String> c) { return c != null && !c.isEmpty(); } Try / catch
try {
query.batchTypes(batchTypes);
} catch (FlowableIllegalArgumentException e) {
// interpret as 'all types' and continue without the filter
} Prevention
- Normalize null/empty collections to 'no filter' before building queries
- Validate user multi-select inputs (require at least one type or treat as all)
- Note that unlike single-value setters, empty collections are also rejected here
When it happens
Trigger: Calling createBatchQuery().batchTypes(null) or .batchTypes(Collections.emptyList()), typically when the list is built dynamically from config or user-selected types.
Common situations: Filter UIs where no type was selected (empty list) and the list is forwarded unchecked; configuration lists that failed to load.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/d2d1376e2cdbe7ce.
Report an issue: GitHub.