flowable/flowable-engine · error · FlowableIllegalArgumentException
id is null
Error message
id is null
What it means
BatchPartQueryImpl.id(String) sets the primary-key filter on a batch part query. Passing null is treated as a programming error, so Flowable throws FlowableIllegalArgumentException instead of returning all results or filtering on 'null id'. The exception is thrown immediately from the id(...) call, before query execution.
Source
Thrown at modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java:67
public BatchPartQueryImpl(CommandExecutor commandExecutor, BatchServiceConfiguration batchServiceConfiguration) {
super(commandExecutor);
this.batchServiceConfiguration = batchServiceConfiguration;
}
@Override
public long executeCount(CommandContext commandContext) {
return batchServiceConfiguration.getBatchPartEntityManager().findBatchPartCountByQueryCriteria(this);
}
@Override
public List<BatchPart> executeList(CommandContext commandContext) {
return batchServiceConfiguration.getBatchPartEntityManager().findBatchPartsByQueryCriteria(this);
}
@Override
public BatchPartQuery id(String id) {
if (id == null) {
throw new FlowableIllegalArgumentException("id is null");
}
this.id = id;
return this;
}
@Override
public BatchPartQuery batchId(String batchId) {
if (batchId == null) {
throw new FlowableIllegalArgumentException("batchId is null");
}
this.batchId = batchId;
return this;
}
@Override
public BatchPartQuery type(String type) {
if (type == null) {
throw new FlowableIllegalArgumentException("type is null");View on GitHub (pinned to d6d39ce1c6)
Solutions
- Null-check the id before calling id(...), or skip the filter entirely when absent.
- Use a singleResult()/list() call appropriate to whether an id filter is applied.
- If id comes from Optional<String>, use optional.orElseThrow(...) or branch on isPresent().
Example fix
// before
BatchPart part = batchService.createBatchPartQuery().id(inputId).singleResult();
// after
if (inputId == null) {
throw new IllegalArgumentException("batch part id required");
}
BatchPart part = batchService.createBatchPartQuery().id(inputId).singleResult(); Defensive patterns
Strategy: validation
Validate before calling
java.util.Objects.requireNonNull(partId, "partId must not be null"); BatchPart part = batchService.createBatchPartQuery().id(partId).singleResult();
Type guard
boolean hasId(String id) {
return id != null && !id.isEmpty();
} Try / catch
try {
BatchPart part = batchService.createBatchPartQuery().id(partId).singleResult();
} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {
throw new IllegalArgumentException("Invalid batch part id passed to query: " + partId, e);
} Prevention
- Validate ids at API boundaries before they reach query code.
- Prefer Optional<String> with explicit orElseThrow for ids that may be absent.
When it happens
Trigger: Calling batchService.createBatchPartQuery().id(null), typically when the id comes from an unvalidated variable, optional lookup, or a request parameter.
Common situations: REST handlers forwarding request params straight into queries; Optional.map chains returning null when the optional was empty; records whose id was never generated.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/975b4ce8c53dadb2.
Report an issue: GitHub.