flowable/flowable-engine · error · FlowableObjectNotFoundException

No job found with id '

Error message

No job found with id '

What it means

DeleteJobCmd loads the job via JobEntityManager.findById and throws FlowableObjectNotFoundException("No job found with id '...'") referencing Job.class when no job entity matches. The id is absent from ACT_RU_JOB (timer/message/async jobs) at delete time.

Solutions

  1. Check existence first with managementService.createJobQuery().jobId(id).count() > 0 and delete only when found.
  2. Catch FlowableObjectNotFoundException and treat as already-deleted in cleanup/cancel code.
  3. Use the correct manager/table for the job kind (suspended, dead letter, timer, external worker, history) — a plain DeleteJobCmd only sees ACT_RU_JOB.
  4. Verify the engine and database the id was issued from match the one performing the delete.

Example fix

// before
managementService.deleteJob(timerJobId);
// after
if (managementService.createJobQuery().jobId(timerJobId).count() > 0) {
    managementService.deleteJob(timerJobId);
}
Defensive patterns

Strategy: validation

Validate before calling

Job job = managementService.createJobQuery().jobId(jobId).singleResult();
if (job == null) {
    LOGGER.info("Job {} does not exist; nothing to delete", jobId);
    return;
}

Try / catch

try {
    managementService.deleteJob(jobId);
} catch (FlowableObjectNotFoundException e) {
    LOGGER.info("Job {} already deleted or never existed", jobId);
}

Prevention

When it happens

Trigger: managementService.deleteJob(id) for a job that was already executed by the async executor, a typo'd id, or an id belonging to another job table (timer suspended, dead letter, external worker, history job).

Common situations: Race between user-driven cleanup and the async job executor consuming the job; canceling a process instance already removed its jobs; deleting timer jobs that fired and were deleted on completion; multi-engine/multi-schema confusion.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

    protected void sendCancelEvent(JobEntity jobToDelete) {
        FlowableEventDispatcher eventDispatcher = jobServiceConfiguration.getEventDispatcher();
        if (eventDispatcher != null && eventDispatcher.isEnabled()) {
            eventDispatcher.dispatchEvent(FlowableJobEventBuilder.createEntityEvent(FlowableEngineEventType.JOB_CANCELED, jobToDelete),
                    jobServiceConfiguration.getEngineName());
        }
    }

    protected JobEntity getJobToDelete(CommandContext commandContext) {
        if (jobId == null) {
            throw new FlowableIllegalArgumentException("jobId is null");
        }
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Deleting job {}", jobId);
        }

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

        // We need to check if the job was locked, ie acquired by the job acquisition thread
        // This happens if the job was already acquired, but not yet executed.
        // In that case, we can't allow to delete the job.
        if (job.getLockOwner() != null) {
            throw new FlowableException("Cannot delete " + job + " when the job is being executed. Try again later.");
        }
        return job;
    }

}

View on GitHub (pinned to d6d39ce1c6)