flowable/flowable-engine · error · FlowableIllegalArgumentException
type has to be provided
Error message
type has to be provided
What it means
BatchPartBuilderImpl.create() requires a batch part type (BatchPartBuilder.type(String)) which classifies the part within the batch (e.g. a search/batch-part type registered in BatchServiceConfiguration). When type was never set, Flowable throws FlowableIllegalArgumentException before persisting. This prevents unclassifiable batch parts that the batch type handlers could not route.
Solutions
- Call type("<your-registered-batch-part-type>") on the builder before create().
- Ensure the type string matches one registered in BatchServiceConfiguration (batchTypeHandlers / batchTypes), else validation or routing fails later.
- If the type comes from a variable, null-check it before building.
- Check that refactoring did not drop the type(...) line in the builder chain.
Example fix
// before
BatchPart part = batchService.createBatchPartBuilder()
.batch(batch)
.create();
// after
BatchPart part = batchService.createBatchPartBuilder()
.batch(batch)
.type("search")
.create(); Defensive patterns
Strategy: validation
Validate before calling
if (partType == null || partType.isEmpty()) {
throw new IllegalStateException("Batch part type must be set before create()");
}
BatchPart part = batchService.createBatchPartBuilder()
.batch(batch)
.type(partType)
.create(); Type guard
boolean isValidBatchPartType(String t) {
return t != null && !t.trim().isEmpty();
} Try / catch
try {
BatchPart part = builder.create();
} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {
if (e.getMessage().contains("type has to be provided")) {
throw new IllegalStateException("BatchPartBuilder.type(...) was not called before create()", e);
}
throw e;
} Prevention
- Define batch part types as constants/enums and require one in your helper method signature.
- Validate type values against the registered batch types in BatchServiceConfiguration.
- Keep the type(...) call adjacent to batch(...) in builder chains so it cannot be dropped.
When it happens
Trigger: Calling BatchPartBuilder.create() without calling type(String) on the builder, or calling type(null).
Common situations: Dynamic part creation where the type comes from config/lookup and was null; missing handler registration for a custom batch type so the caller skipped setting it; refactoring that renamed the type constant.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- batch has to be provided
- batchId is null
- batchSearchKey is null
- batchSearchKey2 is null
- batchType is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/502c6af913972122.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-batch-service/src/main/java/org/flowable/batch/service/BatchPartBuilderImpl.java:114
}
@Override
public BatchPartBuilder scopeType(String scopeType) {
if (scopeType == null) {
throw new FlowableIllegalArgumentException("scopeType is null");
}
this.scopeType = scopeType;
return this;
}
@Override
public BatchPart create() {
if (batch == null) {
throw new FlowableIllegalArgumentException("batch has to be provided");
}
if (type == null) {
throw new FlowableIllegalArgumentException("type has to be provided");
}
if (commandExecutor != null) {
return commandExecutor.execute(commandContext -> createSafe());
} else {
return createSafe();
}
}
protected BatchPart createSafe() {
BatchPartEntityManager partEntityManager = batchServiceConfiguration.getBatchPartEntityManager();
BatchPartEntity batchPart = partEntityManager.create();
batchPart.setBatchId(batch.getId());
batchPart.setBatchType(batch.getBatchType());
batchPart.setBatchSearchKey(batch.getBatchSearchKey());
batchPart.setBatchSearchKey2(batch.getBatchSearchKey2());
if (batch.getTenantId() != null) {
batchPart.setTenantId(batch.getTenantId());
}View on GitHub (pinned to d6d39ce1c6)