{"record":{"id":"c9e2ff1e8c38f762","repo":"flowable/flowable-engine","slug":"tenant-id-is-null-c9e2ff","errorCode":null,"errorMessage":"tenant id is null","messagePattern":"tenant id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java","lineNumber":736,"sourceCode":"            this.referenceType = referenceType;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQuery caseInstanceIsCompleteable() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.completeable = true;\n        } else {\n            this.completeable = true;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQueryImpl caseInstanceTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"tenant id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.tenantId = tenantId;\n        } else {\n            this.tenantId = tenantId;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQueryImpl caseInstanceTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"tenant id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.tenantIdLike = tenantIdLike;\n        } else {\n            this.tenantIdLike = tenantIdLike;","sourceCodeStart":718,"sourceCodeEnd":754,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L718-L754","documentation":"FlowableIllegalArgumentException with message \"tenant id is null\" thrown by CaseInstanceQueryImpl.caseInstanceTenantId(String) when tenantId is null. Tenant filtering is exact-match only; null tenancy cannot be expressed. Pass the tenant id string (empty string is allowed for 'no tenant' semantics per Flowable conventions, null is not).","triggerScenarios":"Calling caseInstanceTenantId(null) on a CaseInstanceQuery, commonly in multi-tenant code where the tenant resolver returned null (no authenticated tenant context).","commonSituations":"Multi-tenant deployments where the security context lost the tenant header; scheduled jobs running without tenant propagation; caseInstanceTenantId vs caseInstanceTenantIdWithoutFilter confusion.","solutions":["Pass a non-null tenant id string.","If the query should ignore tenants, omit the tenant filter or use caseInstanceTenantIdWithoutFilter().","Ensure the tenant context (e.g. from authentication) is propagated to query-building code.","Caller-side null check before applying the tenant filter."],"exampleFix":"// before\nquery.caseInstanceTenantId(TenantContext.getTenantId()); // may be null\n// after\nString tenantId = TenantContext.getTenantId();\nif (tenantId != null) {\n    query.caseInstanceTenantId(tenantId);\n} else {\n    query.caseInstanceTenantIdWithoutFilter();\n}","handlingStrategy":"validation","validationCode":"String tenantId = TenantContext.getTenantId();\nif (tenantId != null) { query.caseInstanceTenantId(tenantId); } else { query.caseInstanceTenantIdWithoutFilter(); }","typeGuard":"boolean hasTenant(String t) { return t != null; }","tryCatchPattern":"try { query.caseInstanceTenantId(tenantId); } catch (FlowableIllegalArgumentException e) { log.warn(\"tenant id null: {}\", e.getMessage()); }","preventionTips":["Ensure tenant context propagation (headers, auth) in async/scheduled code.","Use caseInstanceTenantIdWithoutFilter() when tenant filtering is intentionally disabled.","Fail fast when a tenant-scoped operation runs without tenant context."],"tags":["flowable","cmmn","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-14T11:17:12.474Z"}