flowable/flowable-engine · error · FlowableIllegalArgumentException
TenantId is null
Error message
TenantId is null
What it means
UserQueryImpl.tenantId(String) throws FlowableIllegalArgumentException when the tenantId argument is null. Flowable multi-tenancy queries require an explicit tenant identifier; a null tenant would silently change result scope, so it is rejected. Pass a valid tenant id or omit the criterion.
Solutions
- Pass a valid tenant id string.
- Guard: only apply tenantId() when the resolved tenant is non-null.
- Fix the tenant-context provider so it returns a concrete tenant for this execution path.
Example fix
// before
UserQuery q = identityService.createUserQuery().tenantId(TenantContext.getTenantId());
// after
UserQuery q = identityService.createUserQuery();
String tenantId = TenantContext.getTenantId();
if (tenantId != null) {
q = q.tenantId(tenantId);
} Defensive patterns
Strategy: validation
Validate before calling
if (tenantId != null && !tenantId.isBlank()) { query = query.tenantId(tenantId); } Type guard
boolean hasTenant(String t) { return t != null && !t.isBlank(); } Try / catch
try { query.tenantId(tenantId); } catch (FlowableIllegalArgumentException e) { log.warn("Null tenantId ignored", e); } Prevention
- Ensure the tenant context is populated for all execution paths including background jobs
- Fail fast with a clear message when tenant resolution returns null in multi-tenant mode
- Centralize tenant extraction in one utility that guarantees non-null or explicit 'no tenant' semantics
When it happens
Trigger: Calling identityService.createUserQuery().tenantId(null).
Common situations: The tenant id comes from a tenant-context holder that is unset outside a tenant-scoped request (background jobs, system-level startup code), then flows into the query.
Related errors
- activity tenant id is null
- deploymentId is null
- entityClass is null
- execution tenant id is null
- form tenantId is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/b61c83df7aded574.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/UserQueryImpl.java:231
throw new FlowableIllegalArgumentException("Provided groupId is null");
}
this.groupId = groupId;
return this;
}
@Override
public UserQuery memberOfGroups(List<String> groupIds) {
if (groupIds == null) {
throw new FlowableIllegalArgumentException("Provided groupIds is null");
}
this.groupIds = groupIds;
return this;
}
@Override
public UserQuery tenantId(String tenantId) {
if (tenantId == null) {
throw new FlowableIllegalArgumentException("TenantId is null");
}
this.tenantId = tenantId;
return this;
}
// sorting //////////////////////////////////////////////////////////
@Override
public UserQuery orderByUserId() {
return orderBy(UserQueryProperty.USER_ID);
}
@Override
public UserQuery orderByUserEmail() {
return orderBy(UserQueryProperty.EMAIL);
}
@OverrideView on GitHub (pinned to d6d39ce1c6)