flowable/flowable-engine · error · FlowableIllegalArgumentException

Provided ids is null

Error message

Provided ids is null

What it means

UserQueryImpl.userIds(List<String>) filters users whose id is in the given list. Passing a null list throws FlowableIllegalArgumentException because an IN criterion requires an explicit collection; null cannot be distinguished from 'no filter'. The check runs at query-build time.

Solutions

  1. Pass a non-null List (use Collections.emptyList() if no ids were collected, though that matches nothing).
  2. Only call userIds(...) when the list is non-null; otherwise skip the criterion.
  3. Fix upstream producers to return empty collections rather than null.

Example fix

// before
List<String> ids = userLookup.findIdsByEmail(email); // may return null
UserQuery q = identityService.createUserQuery().userIds(ids);

// after
List<String> ids = userLookup.findIdsByEmail(email);
UserQuery q = identityService.createUserQuery();
if (ids != null && !ids.isEmpty()) {
    q = q.userIds(ids);
}
Defensive patterns

Strategy: validation

Validate before calling

if (ids == null) { ids = Collections.emptyList(); }
UserQuery q = identityService.createUserQuery();
if (!ids.isEmpty()) { q = q.userIds(ids); }

Type guard

boolean hasIds(List<String> ids) { return ids != null && !ids.isEmpty(); }

Try / catch

try {
    query.userIds(ids);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().contains("ids is null")) { /* skip criterion */ } else { throw e; }
}

Prevention

When it happens

Trigger: Calling UserQuery.userIds(null), usually with a collection built upstream that came back null (e.g. Optional misuse, a service method returning null instead of an empty list).

Common situations: Bulk lookups where the id list was derived from another query that returned null; configuration-driven filters not configured; Java code paths where a null collection slipped past a null-tolerant helper.

Related errors


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

Appendix: source

Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/UserQueryImpl.java:78

    }

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

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

    @Override
    public UserQuery userIds(List<String> ids) {
        if (ids == null) {
            throw new FlowableIllegalArgumentException("Provided ids is null");
        }
        this.ids = ids;
        return this;
    }

    @Override
    public UserQuery userIdIgnoreCase(String id) {
        if (id == null) {
            throw new FlowableIllegalArgumentException("Provided id is null");
        }
        this.idIgnoreCase = id.toLowerCase();
        return this;
    }

    @Override
    public UserQuery userFirstName(String firstName) {
        if (firstName == null) {
            throw new FlowableIllegalArgumentException("Provided first name is null");

View on GitHub (pinned to d6d39ce1c6)