flowable/flowable-engine · error · FlowableIllegalArgumentException

type is null

Error message

type is null

What it means

BatchPartQueryImpl.type(String) filters parts by their batch part type. A null argument throws FlowableIllegalArgumentException at the type(...) call since filtering by null type is not meaningful. The error fires before the query is executed.

Source

Thrown at modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java:85

            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");
        }
        this.type = type;
        return this;
    }

    @Override
    public BatchPartQuery searchKey(String searchKey) {
        if (searchKey == null) {
            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");

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Null-check the type before calling type(...).
  2. If the filter is optional, build the query conditionally (only call type(t) when t != null).
  3. Verify the config/constant supplying the type resolves to a non-null value.

Example fix

// before
BatchPartQuery q = batchService.createBatchPartQuery().type(partType);
// after
BatchPartQuery q = batchService.createBatchPartQuery();
if (partType != null) {
    q.type(partType);
}
Defensive patterns

Strategy: validation

Validate before calling

BatchPartQuery query = batchService.createBatchPartQuery();
if (partType != null) {
    query.type(partType);
}
List<BatchPart> parts = query.list();

Type guard

boolean hasType(String t) {
    return t != null && !t.isEmpty();
}

Try / catch

try {
    List<BatchPart> parts = query.type(partType).list();
} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {
    log.warn("Null part type filter ignored; returning unfiltered results", e);
    parts = batchService.createBatchPartQuery().list();
}

Prevention

When it happens

Trigger: Calling BatchPartQuery.type(null), typically with a type value sourced from config, an enum-derived string, or a request parameter that was null.

Common situations: Configuration key for the batch part type missing; code deriving the type from an enum with no mapping; API clients omitting the type query parameter.

Related errors


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