flowable/flowable-engine · error · ActivitiIllegalArgumentException
deploymentTenantId is null
Error message
deploymentTenantId is null
What it means
DeploymentQueryImpl.deploymentTenantId() throws ActivitiIllegalArgumentException when the tenantId argument is null. Tenant filtering requires an explicit tenant identifier; null is rejected so queries never silently lose tenant isolation.
Solutions
- Pass a non-null tenant id string
- Resolve the tenant context before querying and fail fast if it is missing
- Only add the tenant filter when a tenant is known; otherwise use a deliberately scoped query
- Fix the tenant provider/header extraction returning null
Example fix
// before
query.deploymentTenantId(TenantContext.getCurrentTenantId());
// after
String tenantId = TenantContext.getCurrentTenantId();
if (tenantId == null) {
throw new IllegalStateException("No tenant context available");
}
query.deploymentTenantId(tenantId); Defensive patterns
Strategy: validation
Validate before calling
if (tenantId == null) { throw new IllegalStateException("Tenant context is required for deployment queries"); }
repositoryService.createDeploymentQuery().deploymentTenantId(tenantId)... Type guard
boolean hasTenantContext(TenantContext ctx) { return ctx != null && ctx.getCurrentTenantId() != null; } Try / catch
try {
repositoryService.createDeploymentQuery().deploymentTenantId(tenantId).list();
} catch (ActivitiIllegalArgumentException e) {
log.error("tenantId was null; missing tenant context?", e);
} Prevention
- Resolve tenant context before any tenant-scoped query
- Fail fast with a clear message when tenant resolution returns null
- Ensure background jobs run with an explicit tenant context
When it happens
Trigger: Calling repositoryService.createDeploymentQuery().deploymentTenantId(null), commonly when the tenant id comes from a context holder, security principal, or request header that is absent (e.g. unauthenticated or non-multi-tenant call).
Common situations: Multi-tenant applications where the tenant resolver returns null outside a tenant-scoped request; jobs/schedulers running without tenant context; renamed tenant keys in configuration.
Related errors
- deploymentTenantIdLike is null
- processDefinition tenantId is null
- activity tenant id is null
- Business key is null
- Deployment id is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/b0f323c25d04e5b6.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/DeploymentQueryImpl.java:102
throw new ActivitiIllegalArgumentException("deploymentCategory is null");
}
this.category = deploymentCategory;
return this;
}
@Override
public DeploymentQueryImpl deploymentCategoryNotEquals(String deploymentCategoryNotEquals) {
if (deploymentCategoryNotEquals == null) {
throw new ActivitiIllegalArgumentException("deploymentCategoryExclude is null");
}
this.categoryNotEquals = deploymentCategoryNotEquals;
return this;
}
@Override
public DeploymentQueryImpl deploymentTenantId(String tenantId) {
if (tenantId == null) {
throw new ActivitiIllegalArgumentException("deploymentTenantId is null");
}
this.tenantId = tenantId;
return this;
}
@Override
public DeploymentQueryImpl deploymentTenantIdLike(String tenantIdLike) {
if (tenantIdLike == null) {
throw new ActivitiIllegalArgumentException("deploymentTenantIdLike is null");
}
this.tenantIdLike = tenantIdLike;
return this;
}
@Override
public DeploymentQueryImpl deploymentWithoutTenantId() {
this.withoutTenantId = true;
return this;View on GitHub (pinned to d6d39ce1c6)