{"record":{"id":"f90c25a2e5ffadff","repo":"flowable/flowable-engine","slug":"provided-tenant-id-is-null-f90c25","errorCode":null,"errorMessage":"Provided tenant id is null","messagePattern":"Provided tenant id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/SuspendedJobQueryImpl.java","lineNumber":586,"sourceCode":"    }\n\n    @Override\n    public SuspendedJobQueryImpl 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 SuspendedJobQueryImpl 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 SuspendedJobQueryImpl 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":568,"sourceCodeEnd":604,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/SuspendedJobQueryImpl.java#L568-L604","documentation":"jobTenantId(String) restricts the suspended-job query to one tenant. A null tenantId is rejected with FlowableIllegalArgumentException because the query engine cannot distinguish 'no tenant' from 'no filter'. Callers wanting all tenants must simply not set the filter.","triggerScenarios":"Calling query.jobTenantId(tenantId) where tenantId is null — commonly a tenant resolved from context/security that was absent, or a nullable request parameter passed through.","commonSituations":"Multi-tenant applications where the tenant header/claim is missing (anonymous or misconfigured auth), or code refactored so the tenant variable became optional but the query call remained unconditional.","solutions":["Only call jobTenantId when the tenant id is non-null; omit it to query across all tenants.","Default to a specific tenant identifier appropriate for the deployment.","Fix tenant resolution (auth/context propagation) so the id is populated."],"exampleFix":"// before\nquery.jobTenantId(tenantContext.getTenantId()); // may be null\n// after\nif (tenantContext.getTenantId() != null) {\n    query.jobTenantId(tenantContext.getTenantId());\n}","handlingStrategy":"validation","validationCode":"if (tenantId == null) {\n    throw new IllegalArgumentException(\"jobTenantId requires a non-null tenant id\");\n}","typeGuard":"boolean hasTenant(TenantContext ctx) { return ctx != null && ctx.getTenantId() != null && !ctx.getTenantId().isEmpty(); }","tryCatchPattern":"try {\n    query.jobTenantId(tenantId);\n} catch (FlowableIllegalArgumentException e) {\n    // no tenant filter: query across all tenants\n    query = jobService.createSuspendedJobQuery();\n}","preventionTips":["Only apply tenant filters when the tenant is actually resolved from security context.","Centralize tenant extraction so missing tenants are handled once.","Log/warn when falling back to an unfiltered query, to avoid accidental cross-tenant reads."],"tags":["flowable","job-query","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-14T11:17:12.474Z"}