{"record":{"id":"9a2cc41325b19cad","repo":"flowable/flowable-engine","slug":"provided-tenant-id-is-null-9a2cc4","errorCode":null,"errorMessage":"Provided tenant id is null","messagePattern":"Provided tenant id is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/DeadLetterJobQueryImpl.java","lineNumber":532,"sourceCode":"    }\n\n    @Override\n    public DeadLetterJobQueryImpl exceptionMessage(String exceptionMessage) {\n        if (exceptionMessage == null) {\n            throw new FlowableIllegalArgumentException(\"Provided exception message is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.exceptionMessage = exceptionMessage;\n        } else {\n            this.exceptionMessage = exceptionMessage;\n        }\n        return this;\n    }\n\n    @Override\n    public DeadLetterJobQueryImpl jobTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided 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 DeadLetterJobQueryImpl jobTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"Provided tenant id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.tenantIdLike = tenantIdLike;\n        } else {\n            this.tenantIdLike = tenantIdLike;","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/DeadLetterJobQueryImpl.java#L514-L550","documentation":"DeadLetterJobQueryImpl.jobTenantId(String) requires a non-null tenant id because it is used as an exact-match filter. Passing null is ambiguous (it could mean 'no filter'), so FlowableIllegalArgumentException is thrown. Omit the call entirely when tenant filtering is not needed.","triggerScenarios":"Calling deadLetterJobQuery().jobTenantId(tenantId) where tenantId is null, e.g. from an unauthenticated request context or missing tenant resolution.","commonSituations":"Multi-tenant applications where the tenant provider returns null for unauthenticated/system contexts; configuration keys for tenant id not set in the environment.","solutions":["Only apply the tenant filter when a tenant id is resolved","Default to a valid tenant id constant for system-level queries","Use jobTenantIdLike or omit filtering if you need cross-tenant results","Handle FlowableIllegalArgumentException at the service boundary"],"exampleFix":"// before\nquery.jobTenantId(tenantContext.getCurrentTenantId()); // null for system calls\n// after\nString tenantId = tenantContext.getCurrentTenantId();\nif (tenantId != null) {\n    query.jobTenantId(tenantId);\n}","handlingStrategy":"validation","validationCode":"if (tenantId != null) { query.jobTenantId(tenantId); }","typeGuard":"boolean hasTenant(String t) { return t != null; }","tryCatchPattern":"try { query.jobTenantId(tenantId); } catch (FlowableIllegalArgumentException e) { log.warn(\"No tenant id resolved; querying without tenant filter\", e); }","preventionTips":["Resolve the tenant before building tenant-scoped queries","Decide explicitly what unauthenticated/system contexts should query","Configure a default tenant id for environments where it is unset"],"tags":["flowable","job-query","null-argument","tenant","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-14T11:17:12.474Z"}