openai/codex-plugin-cc · error · Error

No active job found for "${reference}".

Error message

No active job found for "${reference}".

What it means

Thrown by resolveCancelableJob() when a reference is supplied but it matches no job in the active set (queued|running). matchJobReference over the active-only list returned null (the helper does not throw on a clean miss, only on ambiguity). So the id either does not exist or refers to an already-finished job.

Source

Thrown at plugins/codex/scripts/lib/job-control.mjs:289

    throw new Error(`Job ${active.id} is still ${active.status}. Check /codex:status and try again once it finishes.`);
  }

  if (reference) {
    throw new Error(`No finished job found for "${reference}". Run /codex:status to inspect active jobs.`);
  }

  throw new Error("No finished Codex jobs found for this repository yet.");
}

export function resolveCancelableJob(cwd, reference, options = {}) {
  const workspaceRoot = resolveWorkspaceRoot(cwd);
  const jobs = sortJobsNewestFirst(listJobs(workspaceRoot));
  const activeJobs = jobs.filter((job) => job.status === "queued" || job.status === "running");

  if (reference) {
    const selected = matchJobReference(activeJobs, reference);
    if (!selected) {
      throw new Error(`No active job found for "${reference}".`);
    }
    return { workspaceRoot, job: selected };
  }

  const sessionScopedActiveJobs = filterJobsForCurrentSession(activeJobs, options);

  if (sessionScopedActiveJobs.length === 1) {
    return { workspaceRoot, job: sessionScopedActiveJobs[0] };
  }
  if (sessionScopedActiveJobs.length > 1) {
    throw new Error("Multiple Codex jobs are active. Pass a job id to /codex:cancel.");
  }

  if (getCurrentSessionId(options)) {
    throw new Error("No active Codex jobs to cancel for this session.");
  }

  throw new Error("No active Codex jobs to cancel.");

View on GitHub (pinned to db52e28f4d)

Solutions

  1. Run /codex:status and confirm which jobs are still active before cancelling.
  2. If the job already finished, no cancellation is needed.
  3. Re-copy the id and retry, or cancel with no reference if exactly one job is active.

Example fix

// before
resolveCancelableJob(cwd, "done-id");

// after
const snap = buildStatusSnapshot(cwd);
const activeId = snap.running[0]?.id;
if (activeId) resolveCancelableJob(cwd, activeId);
Defensive patterns

Strategy: validation

Validate before calling

function isActiveMatch(jobs, reference) {
  const active = jobs.filter((j) => ["queued", "running"].includes(j.status));
  return active.some((j) => j.id === reference || j.id.startsWith(reference));
}

const jobs = listJobs(workspaceRoot);
if (reference && !isActiveMatch(jobs, reference)) {
  throw new Error(`No active job matches '${reference}'.`);
}

Type guard

function isActiveJob(job) {
  return job != null && ["queued", "running"].includes(job.status);
}

Try / catch

try {
  resolveCancelableJob(cwd, ref);
} catch (err) {
  if (/No active job found/.test(err.message)) {
    const snap = buildStatusSnapshot(cwd);
    if (snap.running.length === 0) console.log("Nothing to cancel.");
  } else throw err;
}

Prevention

When it happens

Trigger: Calling resolveCancelableJob(cwd, ref) where ref is not a prefix/exact match of any currently queued or running job. Reached via /codex:cancel <id>.

Common situations: Trying to cancel a job that already completed/failed; typo in id; id from another session; race where the job finished between the status check and the cancel.

Related errors


AI-assisted analysis of openai/codex-plugin-cc@db52e28f4d (2026-08-13). Data as JSON: /api/errors/b742555c0f7217ba. Report an issue: GitHub.