flowable/flowable-engine · error · FlowableIllegalArgumentException
tenantId is null
Error message
tenantId is null
What it means
BatchPartQueryImpl.tenantId() throws FlowableIllegalArgumentException when the tenantId argument is null. Flowable treats tenant filtering as an explicit exact-match operation; to query across tenants you omit the call, you never pass null.
Solutions
- Pass a non-null tenant id string (use empty string "" if you mean the default tenant)
- Omit .tenantId(...) entirely when querying across all tenants
- Check the tenant context/resolver before building the query
Example fix
// before
query.tenantId(tenantContext.getCurrentTenantId()); // may be null
// after
String tenantId = tenantContext.getCurrentTenantId();
if (tenantId != null) {
query.tenantId(tenantId);
} Defensive patterns
Strategy: validation
Validate before calling
String tenantId = tenantContext.getCurrentTenantId();
if (tenantId == null) {
throw new IllegalStateException("No tenant in context; cannot build tenant-scoped batch part query");
}
query.tenantId(tenantId); Type guard
boolean hasTenantId(String t) { return t != null && !t.isEmpty(); } Try / catch
try {
query.tenantId(tenantId);
} catch (FlowableIllegalArgumentException e) {
// tenant context lost; run unfiltered or fail with a clearer error
} Prevention
- In single-tenant setups use empty string "" or omit the filter, never null
- Resolve tenant id once in an interceptor and reject requests without it
- Distinguish 'no tenant filter' (omit) from 'default tenant' (empty string)
When it happens
Trigger: Calling batchPartQuery().tenantId(null), or forwarding a tenant id from a security/context holder that has no tenant set (single-tenant deployments).
Common situations: Multi-tenant code paths running without authenticated tenant context; copying tenantId from an entity where TENANT_ID_ is empty string but code yields null.
Related errors
- decision tenantId is null
- deploymentTenantId is null
- Provided tenant id is null
- after time is null
- bytes array is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/ae06aaaf9bbf170a.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java:175
throw new FlowableIllegalArgumentException("subScopeId is null");
}
this.subScopeId = subScopeId;
return this;
}
@Override
public BatchPartQuery scopeType(String scopeType) {
if (scopeType == null) {
throw new FlowableIllegalArgumentException("scopeType is null");
}
this.scopeType = scopeType;
return this;
}
@Override
public BatchPartQuery tenantId(String tenantId) {
if (tenantId == null) {
throw new FlowableIllegalArgumentException("tenantId is null");
}
this.tenantId = tenantId;
return this;
}
@Override
public BatchPartQuery tenantIdLike(String tenantIdLike) {
if (tenantIdLike == null) {
throw new FlowableIllegalArgumentException("tenantIdLike is null");
}
this.tenantIdLike = tenantIdLike;
return this;
}
@Override
public BatchPartQuery withoutTenantId() {
this.withoutTenantId = true;
return this;View on GitHub (pinned to d6d39ce1c6)