flowable/flowable-engine · error · ActivitiIllegalArgumentException

jobId is null

Error message

jobId is null

What it means

Null-argument guard in flowable5 GetJobExceptionStacktraceCmd.execute: the jobId supplied to fetch a job's exception stacktrace is null, so the command aborts before the job entity lookup.

Solutions

  1. Ensure a valid job id is passed, obtained via managementService.createJobQuery().list() or timer/job tables
  2. Add a null check before calling getJobExceptionStacktrace
  3. Fix upstream code that produced a null id (e.g. singleResult() on an empty query)

Example fix

// before
Job job = managementService.createJobQuery().jobId(badId).singleResult();
String st = managementService.getJobExceptionStacktrace(job == null ? null : job.getId());
// after
Job job = managementService.createJobQuery().jobId(badId).singleResult();
String st = job != null ? managementService.getJobExceptionStacktrace(job.getId()) : null;
Defensive patterns

Strategy: validation

Validate before calling

if (jobId == null) {
    throw new IllegalArgumentException("jobId must be provided");
}

Type guard

boolean hasJobId(String jobId) { return jobId != null; }

Try / catch

try {
    managementService.getJobExceptionStacktrace(jobId);
} catch (ActivitiIllegalArgumentException e) {
    // null job id: fix caller
}

Prevention

When it happens

Trigger: Calling ManagementService.getJobExceptionStacktrace(null); typically a job id variable that was never assigned, e.g. iterating jobs with a broken lookup or passing an uninitialised field.

Common situations: Null returned from a previous query (singleResult() on no match) and passed straight through; unmarshalled API payloads missing the job id; refactoring left the id unset.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/dbf7129597e90757. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetJobExceptionStacktraceCmd.java:40

import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.flowable.job.api.Job;

/**
 * @author Frederik Heremans
 */
public class GetJobExceptionStacktraceCmd implements Command<String>, Serializable {

    private static final long serialVersionUID = 1L;
    private String jobId;

    public GetJobExceptionStacktraceCmd(String jobId) {
        this.jobId = jobId;
    }

    @Override
    public String execute(CommandContext commandContext) {
        if (jobId == null) {
            throw new ActivitiIllegalArgumentException("jobId is null");
        }

        JobEntity job = commandContext
                .getJobEntityManager()
                .findJobById(jobId);

        if (job == null) {
            throw new ActivitiObjectNotFoundException("No job found with id " + jobId, Job.class);
        }

        return job.getExceptionStacktrace();
    }

}

View on GitHub (pinned to d6d39ce1c6)