flowable/flowable-engine · error · FlowableIllegalArgumentException

tenant id is null

Error message

tenant id is null

What it means

EventSubscriptionQueryImpl.tenantId() rejects null tenant identifiers. Flowable throws FlowableIllegalArgumentException because a null tenantId is ambiguous (multi-tenancy filters must be an explicit string, possibly the empty-ish default). Null filtering is intentionally disallowed on this setter.

Solutions

  1. Resolve a valid tenant id string before calling tenantId(), or fall back to the tenant provider's default
  2. Skip the tenantId() call entirely if no tenant filter should be applied
  3. Fix the tenant resolution (auth context/header extraction) so it never returns null here

Example fix

// before
query.tenantId(tenantContext.getCurrentTenantId());

// after
String tenantId = tenantContext.getCurrentTenantId();
if (tenantId != null) {
    query.tenantId(tenantId);
}
Defensive patterns

Strategy: validation

Validate before calling

if (tenantId == null || tenantId.isBlank()) {
    throw new IllegalStateException("no tenant context available");
}

Type guard

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

Try / catch

try {
    query.tenantId(tenantId);
} catch (FlowableIllegalArgumentException e) {
    log.warn("tenantId null", e);
}

Prevention

When it happens

Trigger: Calling eventSubscriptionQuery.tenantId(null), commonly when the tenant id comes from an unauthenticated context, a missing header (e.g. X-Tenant-Id), or a tenant resolver that returned null.

Common situations: Multi-tenant applications where tenant context is not yet established; copying code that used tenantIdLike or ignored tenant filtering and passing an unset variable.

Related errors


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

Appendix: source

Thrown at modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/EventSubscriptionQueryImpl.java:394

    @Override
    public EventSubscriptionQueryImpl createdAfter(Date afterTime) {
        if (afterTime == null) {
            throw new FlowableIllegalArgumentException("created after time is null");
        }

        if (inOrStatement) {
            this.currentOrQueryObject.createdAfter = afterTime;
        } else {
            this.createdAfter = afterTime;
        }

        return this;
    }

    @Override
    public EventSubscriptionQueryImpl tenantId(String tenantId) {
        if (tenantId == null) {
            throw new FlowableIllegalArgumentException("tenant id is null");
        }

        if (inOrStatement) {
            this.currentOrQueryObject.tenantId = tenantId;
        } else {
            this.tenantId = tenantId;
        }

        return this;
    }

    @Override
    public EventSubscriptionQuery tenantIds(Collection<String> tenantIds) {
        if (tenantIds == null) {
            throw new FlowableIllegalArgumentException("tenant ids is null");
        }

        if (inOrStatement) {

View on GitHub (pinned to d6d39ce1c6)