flowable/flowable-engine · error · FlowableIllegalArgumentException
userId is null
Error message
userId is null
What it means
HistoricCaseInstanceQueryImpl.involvedUser(String userId, String identityLinkType) throws FlowableIllegalArgumentException("userId is null") when the userId parameter is null. This overload filters involvement by a specific identity link type (e.g. participant, owner), and both parameters are required.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java:1095
}
@Override
public HistoricCaseInstanceQuery involvedUser(String userId) {
if (userId == null) {
throw new FlowableIllegalArgumentException("involvedUser is null");
}
if (inOrStatement) {
this.currentOrQueryObject.involvedUser = userId;
} else {
this.involvedUser = userId;
}
return this;
}
@Override
public HistoricCaseInstanceQuery involvedUser(String userId, String identityLinkType) {
if (userId == null) {
throw new FlowableIllegalArgumentException("userId is null");
}
if (identityLinkType == null) {
throw new FlowableIllegalArgumentException("identityLinkType is null");
}
if (inOrStatement) {
this.currentOrQueryObject.involvedUserIdentityLink = new IdentityLinkQueryObject(userId, null, identityLinkType);
} else {
this.involvedUserIdentityLink = new IdentityLinkQueryObject(userId, null, identityLinkType);
}
return this;
}
@Override
public HistoricCaseInstanceQuery involvedGroup(String groupId, String identityLinkType) {
if (groupId == null) {
throw new FlowableIllegalArgumentException("groupId is null");
}
if (identityLinkType == null) {View on GitHub (pinned to d6d39ce1c6)
Solutions
- Ensure userId is non-null before calling the two-arg involvedUser.
- If the link type matters but the user is optional, guard the call with a null check.
- Note the same method also throws "identityLinkType is null" — validate both parameters.
- Provide sensible defaults (e.g. skip the filter) for anonymous/no-user scenarios.
Example fix
// before
query.involvedUser(userId, IdentityLinkType.PARTICIPANT); // userId may be null
// after
if (userId != null) {
query.involvedUser(userId, IdentityLinkType.PARTICIPANT);
} Defensive patterns
Strategy: validation
Validate before calling
if (userId == null) {
throw new IllegalArgumentException("userId is required");
}
if (identityLinkType == null) {
throw new IllegalArgumentException("identityLinkType is required");
}
query.involvedUser(userId, identityLinkType); Type guard
boolean canFilterByUserLink(String userId, String type) {
return userId != null && type != null;
} Try / catch
try {
query.involvedUser(userId, identityLinkType);
} catch (FlowableIllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().contains("is null")) {
// skip filter or rethrow with context
} else {
throw e;
}
} Prevention
- Validate both userId and identityLinkType together before the two-arg call
- Use constants from IdentityLinkType rather than raw strings
- Guard user-derived values from headers/claims which are commonly absent
- Prefer the single-arg involvedUser when link type is irrelevant
When it happens
Trigger: Calling involvedUser(null, identityLinkType) on a HistoricCaseInstanceQuery; typical when the identity-link-typed variant is chosen but the user id source is null.
Common situations: Refactoring from the single-arg involvedUser to the two-arg version while the user id can still be null; user id comes from a header/claim that is absent; test data omitted the user id.
Related errors
- involvedUser is null
- identityLinkType is null
- groupId is null
- groupIds are null
- variableNames is null or empty
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/7a2e8fc7f2279ded.
Report an issue: GitHub.