flowable/flowable-engine · error · FlowableIllegalArgumentException

deploymentTenantId is null

Error message

deploymentTenantId is null

What it means

EventDeploymentQueryImpl.deploymentTenantId() throws FlowableIllegalArgumentException when the tenantId parameter is null. Tenant filtering on event deployments requires an explicit non-null tenant identifier; a null would produce ambiguous SQL. The error message intentionally names the parameter 'deploymentTenantId'.

Solutions

  1. Resolve the tenant id before building the query and skip deploymentTenantId if it is intentionally null.
  2. Check that your tenant provider/context is initialized for the current thread (e.g. async jobs losing the tenant context).
  3. Catch FlowableIllegalArgumentException and surface a clear 'tenant id required' message to the caller.

Example fix

// before
EventDeploymentQuery query = eventRepositoryService.createEventDeploymentQuery().deploymentTenantId(tenantResolver.current());
// after
String tenantId = tenantResolver.current();
EventDeploymentQuery query = eventRepositoryService.createEventDeploymentQuery();
if (tenantId != null) {
    query = query.deploymentTenantId(tenantId);
}
Defensive patterns

Strategy: validation

Validate before calling

String tenantId = tenantResolver.current();
if (tenantId == null && tenantRequired) { throw new IllegalStateException("tenant id required"); }
if (tenantId != null) query.deploymentTenantId(tenantId);

Type guard

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

Try / catch

try {
    query.deploymentTenantId(tenantId);
} catch (FlowableIllegalArgumentException e) {
    throw new MissingTenantContextException("Tenant id was null when querying event deployments", e);
}

Prevention

When it happens

Trigger: Calling eventDeploymentQuery().deploymentTenantId(null), e.g. when the tenant context (like TenantContext.getTenantId()) is not populated, or a multi-tenancy config returned null for a non-tenant request.

Common situations: Multi-tenant applications where the tenant id is resolved from a header/token and the user context was lost or anonymous; calling tenant-aware queries from jobs/schedulers that have no tenant set.

Related errors


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

Appendix: source

Thrown at modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/EventDeploymentQueryImpl.java:132

    @Override
    public EventDeploymentQueryImpl parentDeploymentIdLike(String parentDeploymentIdLike) {
        if (parentDeploymentIdLike == null) {
            throw new FlowableIllegalArgumentException("parentDeploymentIdLike is null");
        }
        this.parentDeploymentIdLike = parentDeploymentIdLike;
        return this;
    }

    @Override
    public EventDeploymentQueryImpl deploymentWithoutTenantId() {
        this.withoutTenantId = true;
        return this;
    }

    @Override
    public EventDeploymentQueryImpl deploymentTenantId(String tenantId) {
        if (tenantId == null) {
            throw new FlowableIllegalArgumentException("deploymentTenantId is null");
        }
        this.tenantId = tenantId;
        return this;
    }

    @Override
    public EventDeploymentQueryImpl deploymentTenantIdLike(String tenantIdLike) {
        if (tenantIdLike == null) {
            throw new FlowableIllegalArgumentException("deploymentTenantIdLike is null");
        }
        this.tenantIdLike = tenantIdLike;
        return this;
    }

    @Override
    public EventDeploymentQueryImpl eventDefinitionKey(String key) {
        if (key == null) {
            throw new FlowableIllegalArgumentException("key is null");

View on GitHub (pinned to d6d39ce1c6)