flowable/flowable-engine · error · FlowableIllegalArgumentException
activity tenant id is null
Error message
activity tenant id is null
What it means
HistoricActivityInstanceQueryImpl.activityTenantId(String) requires a non-null tenant id to filter activity instances by exact tenant. Passing null throws FlowableIllegalArgumentException since the criterion would be ambiguous; to query across all tenants, simply do not call this method.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricActivityInstanceQueryImpl.java:213
return this;
}
@Override
public HistoricActivityInstanceQuery deleteReason(String deleteReason) {
this.deleteReason = deleteReason;
return this;
}
@Override
public HistoricActivityInstanceQuery deleteReasonLike(String deleteReasonLike) {
this.deleteReasonLike = deleteReasonLike;
return this;
}
@Override
public HistoricActivityInstanceQueryImpl activityTenantId(String tenantId) {
if (tenantId == null) {
throw new FlowableIllegalArgumentException("activity tenant id is null");
}
this.tenantId = tenantId;
return this;
}
public String getTenantId() {
return tenantId;
}
@Override
public HistoricActivityInstanceQueryImpl activityTenantIdLike(String tenantIdLike) {
if (tenantIdLike == null) {
throw new FlowableIllegalArgumentException("activity tenant id is null");
}
this.tenantIdLike = tenantIdLike;
return this;
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Only call activityTenantId(tenantId) when tenantId != null
- Fix tenant resolution (default tenant provider) so a valid tenant id is always available
- Use activityTenantIdLike(pattern) with a non-null pattern if fuzzy matching across tenants is intended
Example fix
// before
query.activityTenantId(TenantContext.getCurrentTenantId());
// after
String tenantId = TenantContext.getCurrentTenantId();
if (tenantId != null) {
query.activityTenantId(tenantId);
} Defensive patterns
Strategy: validation
Validate before calling
if (tenantId != null) {
query.activityTenantId(tenantId);
} Type guard
boolean hasTenantId(String t) { return t != null && !t.trim().isEmpty(); } Try / catch
try {
query.activityTenantId(tenantId);
} catch (FlowableIllegalArgumentException e) {
if (!e.getMessage().contains("activity tenant id is null")) throw e;
// rebuild query without tenant filter
} Prevention
- Resolve tenants with a default-provider before applying tenant filters
- Apply tenant criteria only when a tenant context actually exists
When it happens
Trigger: Calling query.activityTenantId(null), or passing a tenant id resolved from context/config that is null (e.g. multi-tenant apps where the current tenant was not resolved).
Common situations: Multi-tenant deployments where tenant resolution fails or defaults are missing; code that unconditionally applies tenant filters even when the request is tenant-less.
Related errors
- variableNames is null or empty
- planItemDefinitionId is null
- planItemDefinitionIds is null
- involvedUser is null
- userId is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/2a979098127262f0.
Report an issue: GitHub.