{"record":{"id":"137c62aad00e7ba5","repo":"Activiti/Activiti","slug":"job-is-null-137c62","errorCode":null,"errorMessage":"job is null","messagePattern":"job is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/SuspendedJobQueryImpl.java","lineNumber":188,"sourceCode":"        return this;\n    }\n\n    public SuspendedJobQueryImpl withException() {\n        this.withException = true;\n        return this;\n    }\n\n    public SuspendedJobQueryImpl 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    public SuspendedJobQueryImpl jobTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new ActivitiIllegalArgumentException(\"job is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    public SuspendedJobQueryImpl jobTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new ActivitiIllegalArgumentException(\"job is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n\n    public SuspendedJobQueryImpl jobWithoutTenantId() {\n        this.withoutTenantId = true;\n        return this;\n    }\n","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/SuspendedJobQueryImpl.java#L170-L206","documentation":"SuspendedJobQueryImpl.jobTenantId() throws ActivitiIllegalArgumentException with the misleading message 'job is null' when the tenantId argument is null. The check validates the tenant id parameter, so the message text is simply a copy-paste bug in the engine; the cause is always a null tenant id passed to this filter.","triggerScenarios":"Calling suspendedJobQuery().jobTenantId(null), commonly when the tenant id comes from an unconfigured deployment, a job with no tenant, or a null request parameter.","commonSituations":"Multi-tenant applications where some data was deployed without a tenant id (tenantId is null in the DB), and code that unconditionally forwards the entity's tenant id into a tenant filter query; upgrade/migration scripts iterating jobs of mixed tenants.","solutions":["Null-check the tenant id and skip the filter when absent, so the query is not tenant-constrained.","For jobs without a tenant, use jobTenantIdWithoutTenantId()-style semantics or omit tenant filtering rather than passing null.","Catch ActivitiIllegalArgumentException and log the actual parameter being validated (tenantId), since the message text 'job is null' is misleading."],"exampleFix":"// before\nmanagementService.createSuspendedJobQuery().jobTenantId(job.getTenantId()).list(); // null for non-tenant deployments\n\n// after\nSuspendedJobQuery q = managementService.createSuspendedJobQuery();\nif (job.getTenantId() != null) {\n    q = q.jobTenantId(job.getTenantId());\n}\nList<Job> jobs = q.list();","handlingStrategy":"validation","validationCode":"SuspendedJobQuery q = managementService.createSuspendedJobQuery();\nif (tenantId != null && !tenantId.isEmpty()) {\n    q = q.jobTenantId(tenantId);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat tenant ids as optional: entities deployed without a tenant yield null","Skip tenant filtering when the id is absent rather than passing null","Note the engine's misleading 'job is null' message: the actual null value is the tenantId parameter"],"tags":["null-argument","query","tenant","activiti","misleading-message"],"backgroundTag":"null-argument","analyzedSha":"56435b1a97deeafdc09dd40074b056c89fba5a8a","analyzedAt":"2026-09-09T21:00:06.703Z","contentChangedAt":"2026-09-09T21:00:06.703Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}