flowable/flowable-engine · error · FlowableIllegalArgumentException

Provided tenant id is null

Error message

Provided tenant id is null

What it means

ExternalWorkerJobQueryImpl.jobTenantId(String) rejects a null tenant id because a null would build an invalid equality predicate on TENANT_ID_. Flowable validates required query arguments eagerly with FlowableIllegalArgumentException. Use jobTenantIdLike() or omit the filter for cross-tenant queries.

Source

Thrown at modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/ExternalWorkerJobQueryImpl.java:469

    }

    @Override
    public ExternalWorkerJobQuery 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 ExternalWorkerJobQuery 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 ExternalWorkerJobQuery 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. Resolve the tenant id before building the query and fail earlier with a clear error if absent
  2. Skip the jobTenantId() call when the query should span all tenants
  3. Default to a known tenant id constant when context is missing and that is safe
  4. Check the tenant context provider/interceptor configuration so tenant ids are always populated

Example fix

// before
query.jobTenantId(tenantContext.getCurrentTenantId()); // null outside tenant scope
// after
String tenantId = tenantContext.getCurrentTenantId();
if (tenantId != null) {
    query.jobTenantId(tenantId);
}
Defensive patterns

Strategy: validation

Validate before calling

String tenantId = tenantContext.getCurrentTenantId();
if (tenantId == null) {
    throw new IllegalStateException("Tenant context not resolved");
}
externalWorkerJobQuery.jobTenantId(tenantId);

Type guard

boolean hasTenant(String t) { return t != null && !t.trim().isEmpty(); }

Prevention

When it happens

Trigger: Calling jobTenantId(null), e.g. when the tenant context was not resolved (no authenticated tenant) or a TenantInfo lookup returned null.

Common situations: Multi-tenant deployments where tenant resolution fails silently; async executors losing tenant context; misconfigured tenant providers.

Related errors


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