{"record":{"id":"1b3e7bc6dd71c6ee","repo":"flowable/flowable-engine","slug":"execution-tenant-id-is-null-1b3e7b","errorCode":null,"errorMessage":"execution tenant id is null","messagePattern":"execution tenant id is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ExecutionQueryImpl.java","lineNumber":212,"sourceCode":"        if (activityId != null) {\n            isActive = true;\n        }\n        return this;\n    }\n\n    @Override\n    public ExecutionQueryImpl parentId(String parentId) {\n        if (parentId == null) {\n            throw new ActivitiIllegalArgumentException(\"Parent id is null\");\n        }\n        this.parentId = parentId;\n        return this;\n    }\n\n    @Override\n    public ExecutionQueryImpl executionTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new ActivitiIllegalArgumentException(\"execution tenant id is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    @Override\n    public ExecutionQueryImpl executionTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new ActivitiIllegalArgumentException(\"execution tenant id is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n\n    @Override\n    public ExecutionQueryImpl executionWithoutTenantId() {\n        this.withoutTenantId = true;\n        return this;","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ExecutionQueryImpl.java#L194-L230","documentation":"ExecutionQueryImpl.executionTenantId throws ActivitiIllegalArgumentException when the tenantId argument is null. Multi-tenant filtering requires an explicit tenant identifier; null is rejected so that an unfiltered multi-tenant query cannot be created accidentally. An empty string is accepted (querying tenants without an id) but null is not.","triggerScenarios":"Calling query.executionTenantId(tenantId) where tenantId is null — typically a TenantContext/provider returning null for missing tenant information.","commonSituations":"Multi-tenant deployments where the tenant is resolved from headers/auth and the resolution step returns null for anonymous or system calls; single-tenant deployments upgraded to multi-tenancy without backfilling tenant context.","solutions":["Resolve and pass a valid tenant id, or pass an empty string \"\" to intentionally match executions without a tenant","Only call executionTenantId when tenant filtering is required and the id is known","Fix tenant resolution (security context, header parsing) so it never yields null unintentionally"],"exampleFix":"// before\nquery.executionTenantId(TenantContext.get());\n// after\nString tenant = TenantContext.get();\nif (tenant != null) {\n    query.executionTenantId(tenant);\n}","handlingStrategy":"validation","validationCode":"String t = tenantId; if (t == null) { t = \"\"; } query.executionTenantId(t);","typeGuard":"boolean hasTenant = tenantId != null;","tryCatchPattern":"try { q.executionTenantId(tenantId); } catch (ActivitiIllegalArgumentException e) { log.error(\"tenant resolution returned null\"); }","preventionTips":["Make tenant resolution return \"\" (no tenant) rather than null","Verify tenant context exists in request filters/interceptors","In multi-tenant setups, fail auth if tenant cannot be determined"],"tags":["java","activiti","multi-tenancy","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-18T11:17:12.947Z"}