flowable/flowable-engine · error · FlowableIllegalArgumentException

ids is an empty collection

Error message

ids is an empty collection

What it means

deploymentIds(Set<String>) throws 'ids is an empty collection' when a non-null but empty set is passed. An empty IN clause is invalid SQL, so Flowable rejects it eagerly instead of producing a query that matches nothing unexpectedly.

Source

Thrown at modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDefinitionQueryImpl.java:142

        this.nameLike = nameLike;
        return this;
    }

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

    @Override
    public AppDefinitionQueryImpl 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 AppDefinitionQueryImpl appDefinitionKey(String key) {
        if (key == null) {
            throw new FlowableIllegalArgumentException("key is null");
        }
        this.key = key;
        return this;
    }

    @Override
    public AppDefinitionQueryImpl appDefinitionKeyLike(String keyLike) {
        if (keyLike == null) {
            throw new FlowableIllegalArgumentException("keyLike is null");

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Skip the deploymentIds filter entirely when the set is empty (an empty filter usually means 'no constraint')
  2. Return early / short-circuit the query when no ids are requested
  3. Decide explicitly whether empty means 'match all' (omit filter) or 'match none' (return empty result without querying)

Example fix

// before
query.deploymentIds(deploymentIds); // throws when empty
// after
if (deploymentIds != null && !deploymentIds.isEmpty()) {
    query.deploymentIds(deploymentIds);
}
Defensive patterns

Strategy: validation

Validate before calling

if (deploymentIds == null || deploymentIds.isEmpty()) {
    return Collections.emptyList(); // or omit the filter, per semantics
}
query.deploymentIds(deploymentIds);

Type guard

boolean isNonEmpty(Set<String> s) { return s != null && !s.isEmpty(); }

Try / catch

try {
    query.deploymentIds(deploymentIds);
} catch (FlowableIllegalArgumentException e) {
    throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage(), e);
}

Prevention

When it happens

Trigger: Calling appDefinitionQuery.deploymentIds(new HashSet<>()) or any Set that ended up empty — e.g. an upstream filter removed all ids, a split of an empty string, or collection-initialization without population.

Common situations: Batch job with no ids selected; search UI submitted with zero selections; ids parsed from a blank config value producing an empty list converted to a set.

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