flowable/flowable-engine · error · FlowableObjectNotFoundException

No job found with id

Error message

No job found with id ${jobId}

What it means

After checking the ASYNC/TIMER/SUSPENDED job entity managers, GetJobExceptionStacktraceCmd throws FlowableObjectNotFoundException when no job entity with the given id exists in any job table. It signals the caller asked for the exception stacktrace of a job that does not exist (or no longer exists).

Solutions

  1. Verify the job id is current by querying for the job (job query or dead-letter/timer job queries) before fetching the stacktrace.
  2. Handle FlowableObjectNotFoundException in the caller and treat it as 'job gone' rather than a hard failure.
  3. Check you are connected to the same database/engine the job was created in; move async executor history/cleanup settings if jobs are being purged too early.

Example fix

// before
String st = managementService.getJobExceptionStacktrace(jobId);
// after
try {
    String st = managementService.getJobExceptionStacktrace(jobId);
} catch (FlowableObjectNotFoundException e) {
    log.warn("Job {} no longer exists; stacktrace unavailable", jobId);
}
Defensive patterns

Strategy: try-catch

Validate before calling

Job job = managementService.createJobQuery(). jobId==null?null: managementService.createJobQuery()...; // verify existence via job/timerJob/deadLetterJob/suspendedJob queries first

Type guard

boolean jobExists = managementService.createJobQuery().jobId(jobId).count() > 0;

Try / catch

try { return managementService.getJobExceptionStacktrace(jobId); } catch (FlowableObjectNotFoundException e) { return null; }

Prevention

When it happens

Trigger: Calling ManagementService.getJobExceptionStacktrace(jobId) (or executing GetJobExceptionStacktraceCmd) with an id that does not match any row in ACT_RU_JOB, ACT_RU_TIMER_JOB, ACT_RU_SUSPENDED_JOB, ACT_RU_DEADLETTER_JOB, or the history job table.

Common situations: The job already executed and was deleted; a history-level/cleanup job removed it; the id came from a different engine or datasource; typo/stale id stored in an external system; job moved between tables after a state change and the caller used an outdated reference.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

            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);
            break;
         default:
             break;
        }

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

        return job.getExceptionStacktrace();
    }

}

View on GitHub (pinned to d6d39ce1c6)