flowable/flowable-engine · error · FlowableObjectNotFoundException

No job found with id

Error message

No job found with id '${jobId}'.

What it means

In SetJobRetriesCmd.execute(), after the job id passes validation, the command searches the job tables for the entity; when no job with that id can be found it throws FlowableObjectNotFoundException ('No job found with id ...', Job.class). It means retries were requested for a job that does not exist (anymore).

Solutions

  1. Catch FlowableObjectNotFoundException and treat it as an idempotent no-op in retry tooling.
  2. Re-fetch the job via a job query before setting retries and handle absence explicitly.
  3. Confirm the same process engine/database is being used; adjust history cleanup retention if jobs are purged while still being managed.

Example fix

// before
managementService.setJobRetries(jobId, 3);
// after
try {
    managementService.setJobRetries(jobId, 3);
} catch (FlowableObjectNotFoundException e) {
    log.warn("Job {} not found; skipping retry reset", jobId);
}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean exists = managementService.createJobQuery().jobId(jobId).count() > 0
    || managementService.createTimerJobQuery().jobId(jobId).count() > 0
    || managementService.createSuspendedJobQuery().jobId(jobId).count() > 0
    || managementService.createDeadLetterJobQuery().jobId(jobId).count() > 0;

Type guard

boolean jobPresent = job != null && job.getId() != null;

Try / catch

try { managementService.setJobRetries(jobId, retries); } catch (FlowableObjectNotFoundException e) { log.warn("Job {} not found; treating as no-op", jobId); }

Prevention

When it happens

Trigger: Calling ManagementService.setJobRetries(jobId, retries) with a well-formed id that matches no job in ACT_RU_JOB/ACT_RU_TIMER_JOB/ACT_RU_SUSPENDED_JOB/ACT_RU_DEADLETTER_JOB.

Common situations: Job already completed/failed and was removed by the async executor or history cleanup; id from a different engine/database; stale id cached in an external dashboard; race where the job is deleted between listing and updating.

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/edf27f983f23c976. Report an issue: GitHub.

Appendix: source

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

        this.jobId = jobId;
        this.retries = retries;
        this.jobServiceConfiguration = jobServiceConfiguration;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        JobEntity job = jobServiceConfiguration.getJobEntityManager().findById(jobId);
        if (job != null) {

            job.setRetries(retries);

            FlowableEventDispatcher eventDispatcher = jobServiceConfiguration.getEventDispatcher();
            if (eventDispatcher != null && eventDispatcher.isEnabled()) {
                eventDispatcher.dispatchEvent(FlowableJobEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, job),
                        jobServiceConfiguration.getEngineName());
            }
        } else {
            throw new FlowableObjectNotFoundException("No job found with id '" + jobId + "'.", Job.class);
        }
        return null;
    }
}

View on GitHub (pinned to d6d39ce1c6)