flowable/flowable-engine · error · FlowableIllegalArgumentException

type is null

Error message

type is null

What it means

BatchPartBuilderImpl.type(String) throws FlowableIllegalArgumentException when the batch part type is null. The type classifies the batch part (e.g. a batch-part category used by the batch service when persisting) and is mandatory, so it is validated at setter time.

Source

Thrown at modules/flowable-batch-service/src/main/java/org/flowable/batch/service/BatchPartBuilderImpl.java:53

    protected String status;
    protected String scopeId;
    protected String subScopeId;
    protected String scopeType;

    public BatchPartBuilderImpl(Batch batch, BatchServiceConfiguration batchServiceConfiguration) {
        this(batch, batchServiceConfiguration, null);
    }

    public BatchPartBuilderImpl(Batch batch, BatchServiceConfiguration batchServiceConfiguration, CommandExecutor commandExecutor) {
        this.batch = batch;
        this.commandExecutor = commandExecutor;
        this.batchServiceConfiguration = batchServiceConfiguration;
    }

    @Override
    public BatchPartBuilder type(String type) {
        if (type == null) {
            throw new FlowableIllegalArgumentException("type is null");
        }
        this.type = type;
        return this;
    }

    @Override
    public BatchPartBuilder searchKey(String searchKey) {
        this.searchKey = searchKey;
        return this;
    }

    @Override
    public BatchPartBuilder searchKey2(String searchKey2) {
        this.searchKey2 = searchKey2;
        return this;
    }

    @Override

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass a non-null, meaningful batch part type string to type(...)
  2. Default the type to a constant when the dynamic lookup yields null
  3. Validate the source of the type value before building the batch part

Example fix

// before
BatchPartBuilder b = batchService.createBatchPartBuilder().type(batchType);
// after
BatchPartBuilder b = batchService.createBatchPartBuilder()
    .type(batchType != null ? batchType : "DEFAULT");
Defensive patterns

Strategy: validation

Validate before calling

Objects.requireNonNull(batchType, "batch part type must not be null");
builder.type(batchType);

Type guard

boolean hasType = batchType instanceof String s && !s.isEmpty();

Try / catch

try {
    builder.type(batchType);
} catch (FlowableIllegalArgumentException e) {
    throw new IllegalArgumentException("Batch part type missing — check type resolution", e);
}

Prevention

When it happens

Trigger: Calling batchService.createBatchPartBuilder().type(null) or passing a variable/config-derived type value that is null.

Common situations: Custom batch jobs where the type constant was refactored away; dynamic type selection returning null for unknown cases.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/72ddf9b463a768d0. Report an issue: GitHub.