flowable/flowable-engine · error · FlowableIllegalArgumentException

user id is null

Error message

user id is null

What it means

Flowable throws this FlowableIllegalArgumentException when CaseInstanceQueryImpl.caseInstanceStartedBy(String) receives a null userId. The started-by filter matches the authenticated user that started the case; null is not accepted as a filter value so queries remain explicit.

Solutions

  1. Pass a concrete user id string; for anonymous starts pass the documented empty/anonymous value if needed
  2. Skip the startedBy filter when the starter is unknown
  3. Resolve the current user with a fallback before building the query

Example fix

// before
query.caseInstanceStartedBy(securityManager.getAuthenticatedUserId()); // may be null
// after
String userId = securityManager.getAuthenticatedUserId();
if (userId != null) {
    query.caseInstanceStartedBy(userId);
}
Defensive patterns

Strategy: validation

Validate before calling

String userId = securityManager.getAuthenticatedUserId();
if (userId != null) {
    query.caseInstanceStartedBy(userId);
}

Type guard

boolean hasAuthenticatedUser(Authentication a) { return a != null && a.getUserId() != null; }

Try / catch

try {
    query.caseInstanceStartedBy(userId);
} catch (FlowableIllegalArgumentException e) {
    log.warn("No starter filter applied (no authenticated user): {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling caseInstanceQuery.caseInstanceStartedBy(null), often because SecurityUtils/Authentication returned no user (anonymous or system context) and that null was forwarded.

Common situations: Running queries from scheduled jobs or system threads without an authenticated user; passing getUserId() result straight into the query; migration code where the starter field is unknown.

Related errors


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

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java:569

    }

    @Override
    public CaseInstanceQueryImpl caseInstanceStartedAfter(Date afterTime) {
        if (afterTime == null) {
            throw new FlowableIllegalArgumentException("after time is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.startedAfter = afterTime;
        } else {
            this.startedAfter = afterTime;
        }
        return this;
    }

    @Override
    public CaseInstanceQueryImpl caseInstanceStartedBy(String userId) {
        if (userId == null) {
            throw new FlowableIllegalArgumentException("user id is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.startedBy = userId;
        } else {
            this.startedBy = userId;
        }
        return this;
    }
    
    @Override
    public CaseInstanceQueryImpl caseInstanceState(String state) {
        if (state == null) {
            throw new FlowableIllegalArgumentException("state is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.state = state;
        } else {
            this.state = state;

View on GitHub (pinned to d6d39ce1c6)