Activiti/Activiti · error · ActivitiIllegalArgumentException

job is null

Error message

job is null

What it means

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.

Solutions

  1. Null-check the tenant id and skip the filter when absent, so the query is not tenant-constrained.
  2. For jobs without a tenant, use jobTenantIdWithoutTenantId()-style semantics or omit tenant filtering rather than passing null.
  3. Catch ActivitiIllegalArgumentException and log the actual parameter being validated (tenantId), since the message text 'job is null' is misleading.

Example fix

// before
managementService.createSuspendedJobQuery().jobTenantId(job.getTenantId()).list(); // null for non-tenant deployments

// after
SuspendedJobQuery q = managementService.createSuspendedJobQuery();
if (job.getTenantId() != null) {
    q = q.jobTenantId(job.getTenantId());
}
List<Job> jobs = q.list();
Defensive patterns

Strategy: validation

Validate before calling

SuspendedJobQuery q = managementService.createSuspendedJobQuery();
if (tenantId != null && !tenantId.isEmpty()) {
    q = q.jobTenantId(tenantId);
}

Prevention

When it happens

Trigger: Calling suspendedJobQuery().jobTenantId(null), commonly when the tenant id comes from an unconfigured deployment, a job with no tenant, or a null request parameter.

Common situations: 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.

Related errors


AI-assisted analysis of Activiti/Activiti@56435b1a97 (2026-09-09). Data as JSON: /api/errors/137c62aad00e7ba5. Report an issue: GitHub.

Appendix: source

Thrown at activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/SuspendedJobQueryImpl.java:188

        return this;
    }

    public SuspendedJobQueryImpl withException() {
        this.withException = true;
        return this;
    }

    public SuspendedJobQueryImpl exceptionMessage(String exceptionMessage) {
        if (exceptionMessage == null) {
            throw new ActivitiIllegalArgumentException("Provided exception message is null");
        }
        this.exceptionMessage = exceptionMessage;
        return this;
    }

    public SuspendedJobQueryImpl jobTenantId(String tenantId) {
        if (tenantId == null) {
            throw new ActivitiIllegalArgumentException("job is null");
        }
        this.tenantId = tenantId;
        return this;
    }

    public SuspendedJobQueryImpl jobTenantIdLike(String tenantIdLike) {
        if (tenantIdLike == null) {
            throw new ActivitiIllegalArgumentException("job is null");
        }
        this.tenantIdLike = tenantIdLike;
        return this;
    }

    public SuspendedJobQueryImpl jobWithoutTenantId() {
        this.withoutTenantId = true;
        return this;
    }

View on GitHub (pinned to 56435b1a97)