flowable/flowable-engine · error · FlowableIllegalArgumentException

ids is an empty collection

Error message

ids is an empty collection

What it means

FlowableIllegalArgumentException thrown by CaseDefinitionQueryImpl.deploymentIds(Set<String>) when the set is non-null but empty. An empty IN-clause would produce invalid or degenerate SQL, so the engine rejects it explicitly. An empty set means the caller has no deployment ids and should either skip the filter or short-circuit to an empty result.

Solutions

  1. Check isEmpty() before calling deploymentIds and skip the filter or return an empty result early.
  2. Guard with ids != null && !ids.isEmpty() before building the query.
  3. Investigate why no deployment ids were collected if a non-empty set was expected.

Example fix

// before
Set<String> ids = collectDeploymentIds(); // may be empty
query.deploymentIds(ids); // throws on empty

// after
Set<String> ids = collectDeploymentIds();
if (ids.isEmpty()) {
    return Collections.emptyList();
}
query.deploymentIds(ids);
Defensive patterns

Strategy: validation

Validate before calling

if (deploymentIds == null || deploymentIds.isEmpty()) {
    return Collections.emptyList(); // match-none semantics
}
query.deploymentIds(deploymentIds);

Type guard

boolean usableIds = deploymentIds != null && !deploymentIds.isEmpty();

Try / catch

try {
    query.deploymentIds(deploymentIds);
} catch (FlowableIllegalArgumentException e) {
    // empty collection — return empty results instead of querying
    return Collections.emptyList();
}

Prevention

When it happens

Trigger: Calling deploymentIds(new HashSet<>()) or deploymentIds(Collections.emptySet()) after collecting zero deployment ids (e.g. no deployments matched an earlier filter).

Common situations: Batch jobs filtering by deployments found in a previous query step; when nothing matched, the empty set was still passed through.

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/efe7a5b836c36510. Report an issue: GitHub.

Appendix: source

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

        this.nameLikeIgnoreCase = nameLikeIgnoreCase;
        return this;
    }

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

    @Override
    public CaseDefinitionQueryImpl deploymentIds(Set<String> deploymentIds) {
        if (deploymentIds == null) {
            throw new FlowableIllegalArgumentException("ids are null");
        } else if (deploymentIds.isEmpty()) {
            throw new FlowableIllegalArgumentException("ids is an empty collection");
        }
        this.deploymentIds = deploymentIds;
        return this;
    }

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

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

View on GitHub (pinned to d6d39ce1c6)