flowable/flowable-engine · error · FlowableIllegalArgumentException

Provided id is null

Error message

Provided id is null

What it means

UserQueryImpl.userId(String) filters IDM users by exact id. Passing null throws FlowableIllegalArgumentException because null is not a usable equality criterion and would silently alter query semantics. Validation is done eagerly when the criterion is added.

Solutions

  1. Check that the id is non-null (and non-empty) before building the query.
  2. Handle the 'id not provided' case explicitly at the application layer (401/400) instead of querying with null.
  3. If you need existence checking, first guard the id source that produced null.

Example fix

// before
User user = identityService.createUserQuery().userId(pathId).singleResult();

// after
if (pathId == null || pathId.isEmpty()) {
    throw new IllegalArgumentException("User id path variable is required");
}
User user = identityService.createUserQuery().userId(pathId).singleResult();
Defensive patterns

Strategy: validation

Validate before calling

if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("User id is required");
}
identityService.createUserQuery().userId(id);

Type guard

boolean hasUserId(String id) { return id != null && !id.trim().isEmpty(); }

Try / catch

try {
    user = identityService.createUserQuery().userId(id).singleResult();
} catch (FlowableIllegalArgumentException e) {
    throw new IllegalArgumentException("Missing user id for user lookup", e);
}

Prevention

When it happens

Trigger: Calling UserQuery.userId(null), typically identityService.createUserQuery().userId(id) where the id variable is null (unknown user, unauthenticated principal, unset request path variable).

Common situations: Looking up a user by an id taken from a URL/JWT claim that is absent; referencing a deleted user id that resolves to null in an earlier step; unit tests passing null accidentally.

Related errors


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

Appendix: source

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

    protected String groupId;
    protected List<String> groupIds;
    protected String tenantId;

    public UserQueryImpl() {
    }

    public UserQueryImpl(CommandContext commandContext) {
        super(commandContext);
    }

    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");

View on GitHub (pinned to d6d39ce1c6)