{"record":{"id":"a934f052f6ff766c","repo":"flowable/flowable-engine","slug":"tenant-id-is-null-a934f0","errorCode":null,"errorMessage":"tenant id is null","messagePattern":"tenant id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/EventSubscriptionQueryImpl.java","lineNumber":394,"sourceCode":"    @Override\n    public EventSubscriptionQueryImpl createdAfter(Date afterTime) {\n        if (afterTime == null) {\n            throw new FlowableIllegalArgumentException(\"created after time is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.createdAfter = afterTime;\n        } else {\n            this.createdAfter = afterTime;\n        }\n\n        return this;\n    }\n\n    @Override\n    public EventSubscriptionQueryImpl tenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"tenant id is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.tenantId = tenantId;\n        } else {\n            this.tenantId = tenantId;\n        }\n\n        return this;\n    }\n\n    @Override\n    public EventSubscriptionQuery tenantIds(Collection<String> tenantIds) {\n        if (tenantIds == null) {\n            throw new FlowableIllegalArgumentException(\"tenant ids is null\");\n        }\n\n        if (inOrStatement) {","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/EventSubscriptionQueryImpl.java#L376-L412","documentation":"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.","triggerScenarios":"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.","commonSituations":"Multi-tenant applications where tenant context is not yet established; copying code that used tenantIdLike or ignored tenant filtering and passing an unset variable.","solutions":["Resolve a valid tenant id string before calling tenantId(), or fall back to the tenant provider's default","Skip the tenantId() call entirely if no tenant filter should be applied","Fix the tenant resolution (auth context/header extraction) so it never returns null here"],"exampleFix":"// before\nquery.tenantId(tenantContext.getCurrentTenantId());\n\n// after\nString tenantId = tenantContext.getCurrentTenantId();\nif (tenantId != null) {\n    query.tenantId(tenantId);\n}","handlingStrategy":"validation","validationCode":"if (tenantId == null || tenantId.isBlank()) {\n    throw new IllegalStateException(\"no tenant context available\");\n}","typeGuard":"boolean hasTenant(String t) { return t != null && !t.isBlank(); }","tryCatchPattern":"try {\n    query.tenantId(tenantId);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"tenantId null\", e);\n}","preventionTips":["Resolve tenant context before building tenant-scoped queries","Skip tenantId() when the query should be unscoped","Guard tenant resolvers so they return defaults instead of null"],"tags":["flowable","query","tenant","null-check"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T16:30:33.424Z"}