flowable/flowable-engine · error · FlowableIllegalArgumentException

Provided tenant id is null

Error message

Provided tenant id is null

What it means

jobTenantId(String) restricts the suspended-job query to one tenant. A null tenantId is rejected with FlowableIllegalArgumentException because the query engine cannot distinguish 'no tenant' from 'no filter'. Callers wanting all tenants must simply not set the filter.

Source

Thrown at modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/SuspendedJobQueryImpl.java:586

    }

    @Override
    public SuspendedJobQueryImpl exceptionMessage(String exceptionMessage) {
        if (exceptionMessage == null) {
            throw new FlowableIllegalArgumentException("Provided exception message is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.exceptionMessage = exceptionMessage;
        } else {
            this.exceptionMessage = exceptionMessage;
        }
        return this;
    }

    @Override
    public SuspendedJobQueryImpl jobTenantId(String tenantId) {
        if (tenantId == null) {
            throw new FlowableIllegalArgumentException("Provided tenant id is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.tenantId = tenantId;
        } else {
            this.tenantId = tenantId;
        }
        return this;
    }

    @Override
    public SuspendedJobQueryImpl jobTenantIdLike(String tenantIdLike) {
        if (tenantIdLike == null) {
            throw new FlowableIllegalArgumentException("Provided tenant id is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.tenantIdLike = tenantIdLike;
        } else {
            this.tenantIdLike = tenantIdLike;

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Only call jobTenantId when the tenant id is non-null; omit it to query across all tenants.
  2. Default to a specific tenant identifier appropriate for the deployment.
  3. Fix tenant resolution (auth/context propagation) so the id is populated.

Example fix

// before
query.jobTenantId(tenantContext.getTenantId()); // may be null
// after
if (tenantContext.getTenantId() != null) {
    query.jobTenantId(tenantContext.getTenantId());
}
Defensive patterns

Strategy: validation

Validate before calling

if (tenantId == null) {
    throw new IllegalArgumentException("jobTenantId requires a non-null tenant id");
}

Type guard

boolean hasTenant(TenantContext ctx) { return ctx != null && ctx.getTenantId() != null && !ctx.getTenantId().isEmpty(); }

Try / catch

try {
    query.jobTenantId(tenantId);
} catch (FlowableIllegalArgumentException e) {
    // no tenant filter: query across all tenants
    query = jobService.createSuspendedJobQuery();
}

Prevention

When it happens

Trigger: Calling query.jobTenantId(tenantId) where tenantId is null — commonly a tenant resolved from context/security that was absent, or a nullable request parameter passed through.

Common situations: Multi-tenant applications where the tenant header/claim is missing (anonymous or misconfigured auth), or code refactored so the tenant variable became optional but the query call remained unconditional.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/f90c25a2e5ffadff. Report an issue: GitHub.