{"record":{"id":"b0f323c25d04e5b6","repo":"flowable/flowable-engine","slug":"deploymenttenantid-is-null-b0f323","errorCode":null,"errorMessage":"deploymentTenantId is null","messagePattern":"deploymentTenantId is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/DeploymentQueryImpl.java","lineNumber":102,"sourceCode":"            throw new ActivitiIllegalArgumentException(\"deploymentCategory is null\");\n        }\n        this.category = deploymentCategory;\n        return this;\n    }\n\n    @Override\n    public DeploymentQueryImpl deploymentCategoryNotEquals(String deploymentCategoryNotEquals) {\n        if (deploymentCategoryNotEquals == null) {\n            throw new ActivitiIllegalArgumentException(\"deploymentCategoryExclude is null\");\n        }\n        this.categoryNotEquals = deploymentCategoryNotEquals;\n        return this;\n    }\n\n    @Override\n    public DeploymentQueryImpl deploymentTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new ActivitiIllegalArgumentException(\"deploymentTenantId is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    @Override\n    public DeploymentQueryImpl deploymentTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new ActivitiIllegalArgumentException(\"deploymentTenantIdLike is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n\n    @Override\n    public DeploymentQueryImpl deploymentWithoutTenantId() {\n        this.withoutTenantId = true;\n        return this;","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/DeploymentQueryImpl.java#L84-L120","documentation":"DeploymentQueryImpl.deploymentTenantId() throws ActivitiIllegalArgumentException when the tenantId argument is null. Tenant filtering requires an explicit tenant identifier; null is rejected so queries never silently lose tenant isolation.","triggerScenarios":"Calling repositoryService.createDeploymentQuery().deploymentTenantId(null), commonly when the tenant id comes from a context holder, security principal, or request header that is absent (e.g. unauthenticated or non-multi-tenant call).","commonSituations":"Multi-tenant applications where the tenant resolver returns null outside a tenant-scoped request; jobs/schedulers running without tenant context; renamed tenant keys in configuration.","solutions":["Pass a non-null tenant id string","Resolve the tenant context before querying and fail fast if it is missing","Only add the tenant filter when a tenant is known; otherwise use a deliberately scoped query","Fix the tenant provider/header extraction returning null"],"exampleFix":"// before\nquery.deploymentTenantId(TenantContext.getCurrentTenantId());\n// after\nString tenantId = TenantContext.getCurrentTenantId();\nif (tenantId == null) {\n    throw new IllegalStateException(\"No tenant context available\");\n}\nquery.deploymentTenantId(tenantId);","handlingStrategy":"validation","validationCode":"if (tenantId == null) { throw new IllegalStateException(\"Tenant context is required for deployment queries\"); }\nrepositoryService.createDeploymentQuery().deploymentTenantId(tenantId)...","typeGuard":"boolean hasTenantContext(TenantContext ctx) { return ctx != null && ctx.getCurrentTenantId() != null; }","tryCatchPattern":"try {\n    repositoryService.createDeploymentQuery().deploymentTenantId(tenantId).list();\n} catch (ActivitiIllegalArgumentException e) {\n    log.error(\"tenantId was null; missing tenant context?\", e);\n}","preventionTips":["Resolve tenant context before any tenant-scoped query","Fail fast with a clear message when tenant resolution returns null","Ensure background jobs run with an explicit tenant context"],"tags":["java","activiti","null-argument","multi-tenancy"],"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"}