{"record":{"id":"1e7f0b95731a226a","repo":"flowable/flowable-engine","slug":"execution-tenant-id-is-null","errorCode":null,"errorMessage":"execution tenant id is null","messagePattern":"execution tenant id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java","lineNumber":545,"sourceCode":"            this.onlySubProcessExecutions = true;\n        }\n        return this;\n    }\n\n    @Override\n    public ExecutionQuery onlyProcessInstanceExecutions() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.onlyProcessInstanceExecutions = true;\n        } else {\n            this.onlyProcessInstanceExecutions = true;\n        }\n        return this;\n    }\n\n    @Override\n    public ExecutionQueryImpl executionTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"execution 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 ExecutionQueryImpl executionTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"execution tenant id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.tenantIdLike = tenantIdLike;\n        } else {\n            this.tenantIdLike = tenantIdLike;","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java#L527-L563","documentation":"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.","triggerScenarios":"Calling executionQuery.executionTenantId(null), typically when TenantContext.getTenantId() or a configuration property returns null in multi-tenant setups.","commonSituations":"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.","solutions":["Pass a non-null tenant ID string, e.g. executionTenantId(\"acme\")","To include executions without a tenant, use executionWithoutTenantId() instead of passing null","Resolve the tenant from the authenticated user/request before building the query, with a defined default","Skip the tenant filter entirely when no tenant is active rather than passing null"],"exampleFix":"// before\nquery.executionTenantId(tenantProvider.currentTenantId()); // throws when null\n// after\nString tenantId = tenantProvider.currentTenantId();\nif (tenantId != null) {\n    query.executionTenantId(tenantId);\n} else {\n    query.executionWithoutTenantId();\n}","handlingStrategy":"validation","validationCode":"String tenantId = tenantProvider.currentTenantId();\nif (tenantId != null) { query.executionTenantId(tenantId); } else { query.executionWithoutTenantId(); }","typeGuard":"boolean hasTenant(String tenantId) { return tenantId != null && !tenantId.isBlank(); }","tryCatchPattern":"try {\n    query.executionTenantId(tenantId);\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    throw new IllegalStateException(\"Tenant not resolved for current request\", e);\n}","preventionTips":["Resolve the tenant (header/token claim) before any tenant-scoped query","Use executionWithoutTenantId() for the no-tenant case instead of null","Provide a documented default tenant for non-tenant deployments","Add an early guard in multi-tenant request handling that rejects unresolved tenants"],"tags":["flowable","query-validation","tenant","null-argument"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}