flowable/flowable-engine · error · ActivitiObjectNotFoundException
No job found with id
Error message
No job found with id
What it means
After the null check, GetJobExceptionStacktraceCmd loads the job by id. If no job with that id exists it throws ActivitiObjectNotFoundException('No job found with id ' + jobId, Job.class), because there is no stored stacktrace to return.
Source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetJobExceptionStacktraceCmd.java:48
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)
Solutions
- Confirm the job exists and is failed: managementService.createJobQuery().jobId(id).singleResult() and check getExceptionByteArrayRef/getRetries
- Catch ActivitiObjectNotFoundException and treat it as 'no stacktrace for this job'
- Get fresh job ids from managementService.createJobQuery().withException().list() before fetching stacktraces
- If using timers, use the appropriate job/timer query or API variant
Example fix
// before
String st = managementService.getJobExceptionStacktrace(jobId);
// after
Job job = managementService.createJobQuery().jobId(jobId).singleResult();
if (job != null && job.getRetries() <= 0) {
String st = managementService.getJobExceptionStacktrace(jobId);
} Defensive patterns
Strategy: try-catch
Validate before calling
boolean jobExists = managementService.createJobQuery().jobId(jobId).count() > 0;
Type guard
boolean jobExists(String jobId) {
return jobId != null && managementService.createJobQuery().jobId(jobId).count() > 0;
} Try / catch
try {
String st = managementService.getJobExceptionStacktrace(jobId);
} catch (ActivitiObjectNotFoundException e) {
// job executed/removed: no stacktrace available
} Prevention
- Fetch stacktraces promptly after detecting a failed job; successful jobs are deleted
- Re-query jobs instead of caching ids across transactions/restarts
- Filter with .withException() to target only failed jobs
When it happens
Trigger: Calling ManagementService.getJobExceptionStacktrace(id) for a job that was already executed and deleted, a wrong id, or querying the wrong job table (timer job vs async job vs suspended job in some versions).
Common situations: Job executed successfully between listing it and fetching its stacktrace (only failed jobs retain stacktraces); stale ids after restart/cleanup; looking up a timer job via the plain job API.
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
- Timer job with id '' doesn't have an exception stacktrace.
- Suspended job with id '' doesn't have an exception stacktrac
- Could not find a job with id ''.
- Job with id '${jobId}' does not have an exception stacktrace
- No job found with id '${jobId}'
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/a9d49dc495db9b68.
Report an issue: GitHub.