alibaba/COLA · error · JobException

No jobExecution with id:${executionId} found

Error message

No jobExecution with id:${executionId} found

What it means

MemoryJobRepository.updateJobExecution looks up the existing JobExecution by jobId in its in-memory map and throws JobException when no entry with that id exists. Updates require the execution to have been saved first; the in-memory store is also empty after restart.

Source

Thrown at cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/repository/memory/MemoryJobRepository.java:72

    }

    @Override
    public JobExecution saveJobExecution(JobExecution jobExecution) {
        Assert.notNull(jobExecution, "jobExecution cannot be null");
        Assert.notNull(jobExecution.getJobDef(), "job cannot be null.");
        Assert.notNull(jobExecution.getJobId(), "jobExecutionId cannot be null.");
        jobMap.put(jobExecution.getJobId(), jobExecution);
        return jobExecution;
    }

    @Override
    public void updateJobExecution(JobExecution jobExecution) {
        Assert.notNull(jobExecution, "jobExecution cannot be null");
        String executionId = jobExecution.getJobId();
        Assert.notNull(executionId, "jobExecutionId cannot be null.");
        JobExecution oldJobExecution = jobMap.get(executionId);
        if (oldJobExecution == null) {
            throw new JobException("No jobExecution with id:" + executionId + " found");
        }
        jobMap.put(executionId, jobExecution);
    }

    @Override
    public void saveStepExecution(StepExecution stepExecution) {
        Assert.notNull(stepExecution.getJobExecution(), "jobExecution cannot be null");
        String jobExecutionId = stepExecution.getJobExecution().getJobId();
        String stepName = stepExecution.getStepName();
        stepMap.put(jobExecutionId + stepName, stepExecution);
        Set<StepExecution> stepSet = stepSetMap.get(jobExecutionId);
        if (stepSet == null) {
            stepSet = new HashSet<>();
            stepSetMap.put(jobExecutionId, stepSet);
        }
        stepSet.add(stepExecution);
    }

View on GitHub (pinned to 352e1a8675)

Solutions

  1. Call saveJobExecution (or create) before updateJobExecution for that id
  2. Verify jobExecution.getJobId() is the correct, persisted identifier
  3. Switch repositoryType to DB or REDIS if state must survive restarts

Example fix

// before
jobRepository.updateJobExecution(execution); // never saved
// after
jobRepository.saveJobExecution(execution);
execution.setStatus(FINISHED);
jobRepository.updateJobExecution(execution);
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the execution exists before updating
if (jobRepository.getJobExecution(execution.getJobId()) == null) {
    jobRepository.saveJobExecution(execution);
}

Try / catch

try {
    jobRepository.updateJobExecution(execution);
} catch (JobException e) {
    if (e.getMessage().startsWith("No jobExecution with id:")) {
        log.warn("Execution {} missing in memory repository; saving anew", execution.getJobId());
        jobRepository.saveJobExecution(execution);
    } else throw e;
}

Prevention

When it happens

Trigger: Calling updateJobExecution with a JobExecution whose jobId was never put into the repository, or after a JVM restart wiped the memory map.

Common situations: Calling update before saveJobExecution; wrong/ungenerated jobId; in-memory repository used across restarts or across different bean instances in tests; data lost because MEMORY repositoryType is not persistent.

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 alibaba/COLA@352e1a8675 (2026-09-08). Data as JSON: /api/errors/58faf8899db1df7f. Report an issue: GitHub.