flowable/flowable-engine · error · ActivitiIllegalArgumentException
Provided tentant id is null
Error message
Provided tentant id is null
What it means
JobQueryImpl.jobTenantId(String) filters jobs to those belonging to one specific tenant. A null tenant id throws ActivitiIllegalArgumentException at query-build time; null is not accepted as a way to 'clear' the tenant filter, so the error is a fail-fast guard against accidental unscoped queries.
Solutions
- Resolve the tenant id before query building and only call jobTenantId() when it is present
- Fix the tenant resolution (auth context, header extraction) that returned null
- If all tenants should be searched, omit the call instead of passing null
Example fix
// before
JobQuery query = managementService.createJobQuery().jobTenantId(getCurrentTenant());
// after
JobQuery query = managementService.createJobQuery();
String tenantId = getCurrentTenant();
if (tenantId != null) {
query = query.jobTenantId(tenantId);
} Defensive patterns
Strategy: validation
Validate before calling
Objects.requireNonNull(tenantId, "Tenant id must be resolved before querying jobs");
Type guard
boolean hasTenant = (String t) -> t != null && !t.trim().isEmpty();
Try / catch
try {
query = query.jobTenantId(tenantId);
} catch (ActivitiIllegalArgumentException e) {
if (!e.getMessage().contains("tentant id is null")) throw e;
// tenant context missing: require re-authentication or return a clear error
} Prevention
- Resolve the tenant id from a verified security context and require it for tenant-scoped operations
- Validate tenant context once per request in a filter/interceptor
- Add integration tests for anonymous/system contexts that may lack tenant info
When it happens
Trigger: Calling managementService.createJobQuery().jobTenantId(null) before executing the query.
Common situations: Multi-tenant applications where the tenant id comes from a request header, thread-local, or security context that was not populated (e.g. anonymous or system jobs); a tenant resolution service returning null; version-migration code where the tenant field was newly introduced.
Related errors
- case definition tenantId is null
- caseDefinition tenantId is null
- deploymentTenantId is null
- deploymentTenantIdLike is null
- processDefinition tenantId is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/47f89b6e3fc4461d.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/JobQueryImpl.java:211
@Override
public JobQuery withException() {
this.withException = true;
return this;
}
@Override
public JobQuery exceptionMessage(String exceptionMessage) {
if (exceptionMessage == null) {
throw new ActivitiIllegalArgumentException("Provided exception message is null");
}
this.exceptionMessage = exceptionMessage;
return this;
}
@Override
public JobQuery jobTenantId(String tenantId) {
if (tenantId == null) {
throw new ActivitiIllegalArgumentException("Provided tentant id is null");
}
this.tenantId = tenantId;
return this;
}
@Override
public JobQuery jobTenantIdLike(String tenantIdLike) {
if (tenantIdLike == null) {
throw new ActivitiIllegalArgumentException("Provided tentant id is null");
}
this.tenantIdLike = tenantIdLike;
return this;
}
@Override
public JobQuery jobWithoutTenantId() {
this.withoutTenantId = true;
return this;View on GitHub (pinned to d6d39ce1c6)