flowable/flowable-engine · error · FlowableIllegalArgumentException

jobId is null

Error message

jobId is null

What it means

GetJobExceptionStacktraceCmd.execute() validates its jobId before looking up the job entity. When the jobId passed to the command is null, it refuses to proceed and throws FlowableIllegalArgumentException. This fail-fast check prevents a pointless and ambiguous database lookup with a null identifier.

Solutions

  1. Check the jobId for null before calling the stack-trace API and return a clear error to your caller.
  2. Trace where the job id comes from (query result, event payload, process variable) and fix the upstream producer of the null value.
  3. If the job may genuinely not exist, first query for the job and handle the not-found case explicitly.

Example fix

// before
String stacktrace = managementService.getJobExceptionStacktrace(jobId);
// after
if (jobId != null) {
    String stacktrace = managementService.getJobExceptionStacktrace(jobId);
} else {
    throw new IllegalStateException("Cannot fetch stacktrace: jobId was not set");
}
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

boolean hasJobId = (jobId != null && !jobId.isEmpty());

Try / catch

try { String st = managementService.getJobExceptionStacktrace(jobId); } catch (FlowableIllegalArgumentException e) { log.error("Bad argument: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling managementAPI/createJobQuery-based stack-trace retrieval APIs (e.g. ManagementService.getJobExceptionStacktrace, or executing GetJobExceptionStacktraceCmd directly) with jobId == null.

Common situations: Job id obtained from a nullable variable, a map lookup that missed, or an API wrapper that forwards null when the caller thinks the job exists; also happens when job id fields are not populated after deserialization.

Related errors


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

Appendix: source

Thrown at modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/GetJobExceptionStacktraceCmd.java:48

public class GetJobExceptionStacktraceCmd implements Command<String>, Serializable {

    private static final long serialVersionUID = 1L;
    
    protected JobServiceConfiguration jobServiceConfiguration;
    
    protected String jobId;
    protected JobType jobType;

    public GetJobExceptionStacktraceCmd(String jobId, JobType jobType, JobServiceConfiguration jobServiceConfiguration) {
        this.jobId = jobId;
        this.jobType = jobType;
        this.jobServiceConfiguration = jobServiceConfiguration;
    }

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

        AbstractRuntimeJobEntity job = null;
        switch (jobType) {
        case ASYNC:
            job = jobServiceConfiguration.getJobEntityManager().findById(jobId);
            break;
        case TIMER:
            job = jobServiceConfiguration.getTimerJobEntityManager().findById(jobId);
            break;
        case SUSPENDED:
            job = jobServiceConfiguration.getSuspendedJobEntityManager().findById(jobId);
            break;
        case DEADLETTER:
            job = jobServiceConfiguration.getDeadLetterJobEntityManager().findById(jobId);
            break;
        case EXTERNAL_WORKER:
            job = jobServiceConfiguration.getExternalWorkerJobEntityManager().findById(jobId);

View on GitHub (pinned to d6d39ce1c6)