{"record":{"id":"47f89b6e3fc4461d","repo":"flowable/flowable-engine","slug":"provided-tentant-id-is-null","errorCode":null,"errorMessage":"Provided tentant id is null","messagePattern":"Provided tentant id is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/JobQueryImpl.java","lineNumber":211,"sourceCode":"    @Override\n    public JobQuery withException() {\n        this.withException = true;\n        return this;\n    }\n\n    @Override\n    public JobQuery exceptionMessage(String exceptionMessage) {\n        if (exceptionMessage == null) {\n            throw new ActivitiIllegalArgumentException(\"Provided exception message is null\");\n        }\n        this.exceptionMessage = exceptionMessage;\n        return this;\n    }\n\n    @Override\n    public JobQuery jobTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new ActivitiIllegalArgumentException(\"Provided tentant id is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    @Override\n    public JobQuery jobTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new ActivitiIllegalArgumentException(\"Provided tentant id is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n\n    @Override\n    public JobQuery jobWithoutTenantId() {\n        this.withoutTenantId = true;\n        return this;","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/JobQueryImpl.java#L193-L229","documentation":"JobQueryImpl.jobTenantId(String) filters jobs to those belonging to one specific tenant. A null tenant id throws ActivitiIllegalArgumentException at query-build time; null is not accepted as a way to 'clear' the tenant filter, so the error is a fail-fast guard against accidental unscoped queries.","triggerScenarios":"Calling managementService.createJobQuery().jobTenantId(null) before executing the query.","commonSituations":"Multi-tenant applications where the tenant id comes from a request header, thread-local, or security context that was not populated (e.g. anonymous or system jobs); a tenant resolution service returning null; version-migration code where the tenant field was newly introduced.","solutions":["Resolve the tenant id before query building and only call jobTenantId() when it is present","Fix the tenant resolution (auth context, header extraction) that returned null","If all tenants should be searched, omit the call instead of passing null"],"exampleFix":"// before\nJobQuery query = managementService.createJobQuery().jobTenantId(getCurrentTenant());\n\n// after\nJobQuery query = managementService.createJobQuery();\nString tenantId = getCurrentTenant();\nif (tenantId != null) {\n    query = query.jobTenantId(tenantId);\n}","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(tenantId, \"Tenant id must be resolved before querying jobs\");","typeGuard":"boolean hasTenant = (String t) -> t != null && !t.trim().isEmpty();","tryCatchPattern":"try {\n    query = query.jobTenantId(tenantId);\n} catch (ActivitiIllegalArgumentException e) {\n    if (!e.getMessage().contains(\"tentant id is null\")) throw e;\n    // tenant context missing: require re-authentication or return a clear error\n}","preventionTips":["Resolve the tenant id from a verified security context and require it for tenant-scoped operations","Validate tenant context once per request in a filter/interceptor","Add integration tests for anonymous/system contexts that may lack tenant info"],"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"}