flowable/flowable-engine · error · ActivitiObjectNotFoundException

No job found with id '" + jobId + "'.

Error message

No job found with id '" + jobId + "'.

What it means

SetJobRetriesCmd.execute() loads the job by id and updates its retry count; if findJob returns null, it throws ActivitiObjectNotFoundException with the id and Job.class, since the target job does not exist.

Solutions

  1. Verify the job exists: ManagementService.createJobQuery().jobId(jobId).singleResult() before setting retries.
  2. Confirm you are connected to the same database/engine where the job lives.
  3. Handle the not-found case gracefully (log and skip) if jobs are short-lived.

Example fix

// before
managementService.setJobRetries(jobId, 5);
// after
Job job = managementService.createJobQuery().jobId(jobId).singleResult();
if (job != null) {
    managementService.setJobRetries(jobId, 5);
}
Defensive patterns

Strategy: validation

Validate before calling

Job job = managementService.createJobQuery().jobId(jobId).singleResult();
if (job == null) throw new IllegalArgumentException("No job " + jobId);

Try / catch

try { managementService.setJobRetries(jobId, retries); }
catch (ActivitiObjectNotFoundException e) { log.warn("job {} no longer exists", jobId); }

Prevention

When it happens

Trigger: ManagementService.setJobRetries(jobId, n) with an id not present in the job tables — job already executed/removed, wrong database, or id from a different engine instance.

Common situations: Retrying maintenance on a job that completed between listing and update (race), environment mismatch, or the job was deleted by job cleanup/timeout handlers.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/SetJobRetriesCmd.java:63

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

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

            if (commandContext.getEventDispatcher().isEnabled()) {
                commandContext.getEventDispatcher().dispatchEvent(
                        ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, job),
                        EngineConfigurationConstants.KEY_PROCESS_ENGINE_CONFIG);
            }
        } else {
            throw new ActivitiObjectNotFoundException("No job found with id '" + jobId + "'.", Job.class);
        }
        return null;
    }
}

View on GitHub (pinned to d6d39ce1c6)