flowable/flowable-engine · error · FlowableIllegalArgumentException
batchType is null
Error message
batchType is null
What it means
BatchPartQueryImpl.batchType(String) filters batch parts by the type of their parent batch. A null argument throws FlowableIllegalArgumentException immediately — the library refuses null filters. Thrown at the batchType(...) call before query execution.
Source
Thrown at modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java:112
throw new FlowableIllegalArgumentException("searchKey is null");
}
this.searchKey = searchKey;
return this;
}
@Override
public BatchPartQuery searchKey2(String searchKey2) {
if (searchKey2 == null) {
throw new FlowableIllegalArgumentException("searchKey2 is null");
}
this.searchKey2 = searchKey2;
return this;
}
@Override
public BatchPartQuery batchType(String batchType) {
if (batchType == null) {
throw new FlowableIllegalArgumentException("batchType is null");
}
this.batchType = batchType;
return this;
}
@Override
public BatchPartQuery batchSearchKey(String searchKey) {
if (searchKey == null) {
throw new FlowableIllegalArgumentException("batchSearchKey is null");
}
this.batchSearchKey = searchKey;
return this;
}
@Override
public BatchPartQuery batchSearchKey2(String searchKey2) {
if (searchKey2 == null) {
throw new FlowableIllegalArgumentException("batchSearchKey2 is null");View on GitHub (pinned to d6d39ce1c6)
Solutions
- Null-check the batch type before calling batchType(...).
- Apply the filter conditionally when the type is optional.
- Verify the configuration/enum providing the batch type yields a non-null value.
Example fix
// before
BatchPartQuery q = batchService.createBatchPartQuery().batchType(batchType);
// after
BatchPartQuery q = batchService.createBatchPartQuery();
if (batchType != null) {
q.batchType(batchType);
} Defensive patterns
Strategy: validation
Validate before calling
BatchPartQuery query = batchService.createBatchPartQuery();
if (batchType != null) {
query.batchType(batchType);
}
List<BatchPart> parts = query.list(); Type guard
boolean hasBatchType(String t) {
return t != null && !t.isEmpty();
} Try / catch
try {
List<BatchPart> parts = query.batchType(batchType).list();
} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {
throw new IllegalArgumentException("batchType must not be null when filtering batch parts", e);
} Prevention
- Resolve batch types from a single non-null constants/config source.
- Null-check configuration-derived filter values before passing them to queries.
When it happens
Trigger: Calling BatchPartQuery.batchType(null), usually when the batch type is read from configuration, a BatchType-derived string, or a nullable request parameter.
Common situations: Missing config entry for the batch type; enum-to-string conversion returning null; clients omitting the batch type parameter.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/5fee485b5f9d4934.
Report an issue: GitHub.