flowable/flowable-engine · error · FlowableIllegalArgumentException

execution tenant id is null

Error message

execution tenant id is null

What it means

executionTenantId() filters executions by tenant ID. Flowable throws FlowableIllegalArgumentException when the tenant ID string is null; the tenant equality predicate cannot be built from null. Note there is no dedicated 'unset tenant' sentinel here — passing null is never valid.

Solutions

  1. Pass a non-null tenant ID string, e.g. executionTenantId("acme")
  2. To include executions without a tenant, use executionWithoutTenantId() instead of passing null
  3. Resolve the tenant from the authenticated user/request before building the query, with a defined default
  4. Skip the tenant filter entirely when no tenant is active rather than passing null

Example fix

// before
query.executionTenantId(tenantProvider.currentTenantId()); // throws when null
// after
String tenantId = tenantProvider.currentTenantId();
if (tenantId != null) {
    query.executionTenantId(tenantId);
} else {
    query.executionWithoutTenantId();
}
Defensive patterns

Strategy: validation

Validate before calling

String tenantId = tenantProvider.currentTenantId();
if (tenantId != null) { query.executionTenantId(tenantId); } else { query.executionWithoutTenantId(); }

Type guard

boolean hasTenant(String tenantId) { return tenantId != null && !tenantId.isBlank(); }

Try / catch

try {
    query.executionTenantId(tenantId);
} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {
    throw new IllegalStateException("Tenant not resolved for current request", e);
}

Prevention

When it happens

Trigger: Calling executionQuery.executionTenantId(null), typically when TenantContext.getTenantId() or a configuration property returns null in multi-tenant setups.

Common situations: Multi-tenant applications where the tenant was not resolved for the current request (missing header/token claim); default-tenant deployments where code assumes a tenant that was never configured.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java:545

            this.onlySubProcessExecutions = true;
        }
        return this;
    }

    @Override
    public ExecutionQuery onlyProcessInstanceExecutions() {
        if (inOrStatement) {
            this.currentOrQueryObject.onlyProcessInstanceExecutions = true;
        } else {
            this.onlyProcessInstanceExecutions = true;
        }
        return this;
    }

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

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

View on GitHub (pinned to d6d39ce1c6)