flowable/flowable-engine · error · FlowableIllegalArgumentException

Provided userId is null

Error message

Provided userId is null

What it means

Flowable's GroupQueryImpl.groupMember(String userId) throws FlowableIllegalArgumentException when the userId argument is null. The query API validates every criterion parameter eagerly so invalid queries fail at construction time rather than producing confusing SQL errors later. Passing null here means the query would be unexecutable or semantically meaningless.

Source

Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/GroupQueryImpl.java:112

            throw new FlowableIllegalArgumentException("Provided name is null");
        }
        this.nameLikeIgnoreCase = nameLikeIgnoreCase.toLowerCase();
        return this;
    }

    @Override
    public GroupQuery groupType(String type) {
        if (type == null) {
            throw new FlowableIllegalArgumentException("Provided type is null");
        }
        this.type = type;
        return this;
    }

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

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

    // sorting ////////////////////////////////////////////////////////

    @Override
    public GroupQuery orderByGroupId() {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Check for null before calling groupMember and only add the criterion when a valid userId exists
  2. Use groupMembers(List) with a validated non-null list if you have multiple users, or skip the filter to query all groups
  3. Default the userId to a sentinel value or handle the no-user case explicitly in your business logic

Example fix

// before
GroupQuery query = identityService.createGroupQuery().groupMember(userId);
// after
GroupQuery query = identityService.createGroupQuery();
if (userId != null) {
    query.groupMember(userId);
}
Defensive patterns

Strategy: validation

Validate before calling

if (userId == null) { throw new IllegalArgumentException("userId must not be null before groupMember()"); }

Type guard

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

Try / catch

try { query.groupMember(userId); } catch (FlowableIllegalArgumentException e) { log.warn("Invalid group query: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling groupMember(null) on a GroupQuery obtained from createGroupQuery(), typically when the userId variable was never initialized, came from an empty upstream lookup (e.g. userId = user.getId() where user is null), or was passed through unconditionally from caller code.

Common situations: Building dynamic group-membership queries where an optional filter is applied blindly; resolving a userId from a nullable entity or external request parameter; copy-pasted query-builder code that sets filters without null checks.

Related errors


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