flowable/flowable-engine · error · FlowableIllegalArgumentException

Empty caseDefinitionIds

Error message

Empty caseDefinitionIds

What it means

Query-builder validation in CaseDefinitionQueryImpl.caseDefinitionIds: the supplied id Set is non-null but empty, which would generate a nonsensical 'IN ()' SQL clause; the builder rejects it so callers fix their collection rather than get silently wrong results.

Solutions

  1. Check the set has elements before calling caseDefinitionIds; if empty, either skip the method call (no filter) or return an empty result deliberately
  2. Fix the upstream filtering logic so the allowed-ids set is populated

Example fix

// before
query.caseDefinitionIds(allowedIds); // allowedIds may be empty
// after
if (allowedIds != null && !allowedIds.isEmpty()) {
    query.caseDefinitionIds(allowedIds);
}
Defensive patterns

Strategy: validation

Validate before calling

if (ids != null && ids.isEmpty()) {
    // decide: skip filter, or return empty result early
}

Type guard

boolean hasElements = ids != null && !ids.isEmpty();

Try / catch

try {
    query.caseDefinitionIds(ids);
} catch (FlowableIllegalArgumentException e) {
    // empty set: either skip filter or return empty result
}

Prevention

When it happens

Trigger: Calling caseDefinitionQuery.caseDefinitionIds(new HashSet<>()) or passing a set that ended up empty after filtering.

Common situations: Building allowed-ids filters from tenant/permission logic that produced no matches; copy/paste where an unfiltered query was intended.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CaseDefinitionQueryImpl.java:87

        super(commandContext);
    }

    public CaseDefinitionQueryImpl(CommandExecutor commandExecutor) {
        super(commandExecutor);
    }

    @Override
    public CaseDefinitionQueryImpl caseDefinitionId(String caseDefinitionId) {
        this.id = caseDefinitionId;
        return this;
    }

    @Override
    public CaseDefinitionQuery caseDefinitionIds(Set<String> caseDefinitionIds) {
        if (caseDefinitionIds == null) {
            throw new FlowableIllegalArgumentException("caseDefinitionIds is null");
        } else if (caseDefinitionIds.isEmpty()) {
            throw new FlowableIllegalArgumentException("Empty caseDefinitionIds");
        }
        this.ids = caseDefinitionIds;
        return this;
    }

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

    @Override
    public CaseDefinitionQueryImpl caseDefinitionCategoryLike(String categoryLike) {
        if (categoryLike == null) {
            throw new FlowableIllegalArgumentException("categoryLike is null");

View on GitHub (pinned to d6d39ce1c6)