flowable/flowable-engine · error · FlowableIllegalArgumentException
Provided sub scope id is null
Error message
Provided sub scope id is null
What it means
This FlowableIllegalArgumentException is thrown by SuspendedJobQueryImpl.subScopeId() when the caller passes a null sub scope id. Sub scope ids identify nested scopes (e.g. a plan item within a case) and must be non-null to form a valid filter. The exception is raised at query-build time for fail-fast behavior.
Source
Thrown at modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/SuspendedJobQueryImpl.java:278
this.scopeIds = scopeIds;
}
return this;
}
@Override
public SuspendedJobQueryImpl withoutScopeId() {
if (inOrStatement) {
this.currentOrQueryObject.withoutScopeId = true;
} else {
this.withoutScopeId = true;
}
return this;
}
@Override
public SuspendedJobQueryImpl subScopeId(String subScopeId) {
if (subScopeId == null) {
throw new FlowableIllegalArgumentException("Provided sub scope id is null");
}
if (inOrStatement) {
this.currentOrQueryObject.subScopeId = subScopeId;
} else {
this.subScopeId = subScopeId;
}
return this;
}
@Override
public SuspendedJobQueryImpl scopeType(String scopeType) {
if (scopeType == null) {
throw new FlowableIllegalArgumentException("Provided scope type is null");
}
if (inOrStatement) {
this.currentOrQueryObject.scopeType = scopeType;
} else {
this.scopeType = scopeType;View on GitHub (pinned to d6d39ce1c6)
Solutions
- Only call subScopeId()/planItemInstanceId() when a real id exists
- Resolve the plan item instance first and skip the filter if absent
- Validate inputs before building the query
- Refactor the query assembly to conditionally add filters
Example fix
// before
query.subScopeId(subScopeId); // may be null
// after
if (subScopeId != null) {
query.subScopeId(subScopeId);
} Defensive patterns
Strategy: validation
Validate before calling
if (subScopeId != null) {
query.subScopeId(subScopeId);
} Type guard
boolean hasSubScopeId = subScopeId != null && !subScopeId.isBlank();
Try / catch
try {
query.subScopeId(subScopeId);
} catch (FlowableIllegalArgumentException e) {
if (e.getMessage().contains("sub scope id is null")) {
// skip sub-scope filtering
} else {
throw e;
}
} Prevention
- Only chain planItemInstanceId() after confirming the plan item exists
- Guard optional scope filters in a shared query-builder utility
- Null-check engine lookup results before reading their ids
- Cover null-filter paths in integration tests
When it happens
Trigger: Calling suspendedJobQuery().subScopeId(null) directly, or via planItemInstanceId(null), which delegates to subScopeId().
Common situations: Plan item instance id not resolved before querying; passing a variable that is null when the job is not associated with a plan item; generic query builders that do not skip absent filters.
Related errors
- Provided scope id is null
- Provided case instance id is null
- Provided case definition id is null
- Provided case definition key is null
- Deployment id is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/4affcb8b43d28cdf.
Report an issue: GitHub.