{"record":{"id":"9fdb8ea033c36630","repo":"flowable/flowable-engine","slug":"deploymenttenantid-is-null-9fdb8e","errorCode":null,"errorMessage":"deploymentTenantId is null","messagePattern":"deploymentTenantId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/EventDeploymentQueryImpl.java","lineNumber":132,"sourceCode":"    @Override\n    public EventDeploymentQueryImpl parentDeploymentIdLike(String parentDeploymentIdLike) {\n        if (parentDeploymentIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"parentDeploymentIdLike is null\");\n        }\n        this.parentDeploymentIdLike = parentDeploymentIdLike;\n        return this;\n    }\n\n    @Override\n    public EventDeploymentQueryImpl deploymentWithoutTenantId() {\n        this.withoutTenantId = true;\n        return this;\n    }\n\n    @Override\n    public EventDeploymentQueryImpl deploymentTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"deploymentTenantId is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    @Override\n    public EventDeploymentQueryImpl deploymentTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"deploymentTenantIdLike is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n\n    @Override\n    public EventDeploymentQueryImpl eventDefinitionKey(String key) {\n        if (key == null) {\n            throw new FlowableIllegalArgumentException(\"key is null\");","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/EventDeploymentQueryImpl.java#L114-L150","documentation":"EventDeploymentQueryImpl.deploymentTenantId() throws FlowableIllegalArgumentException when the tenantId parameter is null. Tenant filtering on event deployments requires an explicit non-null tenant identifier; a null would produce ambiguous SQL. The error message intentionally names the parameter 'deploymentTenantId'.","triggerScenarios":"Calling eventDeploymentQuery().deploymentTenantId(null), e.g. when the tenant context (like TenantContext.getTenantId()) is not populated, or a multi-tenancy config returned null for a non-tenant request.","commonSituations":"Multi-tenant applications where the tenant id is resolved from a header/token and the user context was lost or anonymous; calling tenant-aware queries from jobs/schedulers that have no tenant set.","solutions":["Resolve the tenant id before building the query and skip deploymentTenantId if it is intentionally null.","Check that your tenant provider/context is initialized for the current thread (e.g. async jobs losing the tenant context).","Catch FlowableIllegalArgumentException and surface a clear 'tenant id required' message to the caller."],"exampleFix":"// before\nEventDeploymentQuery query = eventRepositoryService.createEventDeploymentQuery().deploymentTenantId(tenantResolver.current());\n// after\nString tenantId = tenantResolver.current();\nEventDeploymentQuery query = eventRepositoryService.createEventDeploymentQuery();\nif (tenantId != null) {\n    query = query.deploymentTenantId(tenantId);\n}","handlingStrategy":"validation","validationCode":"String tenantId = tenantResolver.current();\nif (tenantId == null && tenantRequired) { throw new IllegalStateException(\"tenant id required\"); }\nif (tenantId != null) query.deploymentTenantId(tenantId);","typeGuard":"boolean hasTenant(String t) { return t != null && !t.isEmpty(); }","tryCatchPattern":"try {\n    query.deploymentTenantId(tenantId);\n} catch (FlowableIllegalArgumentException e) {\n    throw new MissingTenantContextException(\"Tenant id was null when querying event deployments\", e);\n}","preventionTips":["Ensure tenant context is propagated to async threads","Resolve tenant id once and validate before querying","Skip tenant filters explicitly for cross-tenant admin queries"],"tags":["null-argument","multi-tenancy","query-builder"],"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"}