openai/codex-plugin-cc · error · Error

No job found for "${reference}". Run /codex:status to list k

Error message

No job found for "${reference}". Run /codex:status to list known jobs.

What it means

Thrown by matchJobReference() when the reference does not exactly match any job id AND is not a prefix of any job id (within the predicate-filtered set). It is the catch-all 'reference resolved to nothing' error for that helper. The message points to /codex:status to list known jobs.

Source

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

  const filtered = jobs.filter(predicate);
  if (!reference) {
    return filtered[0] ?? null;
  }

  const exact = filtered.find((job) => job.id === reference);
  if (exact) {
    return exact;
  }

  const prefixMatches = filtered.filter((job) => job.id.startsWith(reference));
  if (prefixMatches.length === 1) {
    return prefixMatches[0];
  }
  if (prefixMatches.length > 1) {
    throw new Error(`Job reference "${reference}" is ambiguous. Use a longer job id.`);
  }

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

export function buildStatusSnapshot(cwd, options = {}) {
  const workspaceRoot = resolveWorkspaceRoot(cwd);
  const config = getConfig(workspaceRoot);
  const jobs = sortJobsNewestFirst(filterJobsForCurrentSession(listJobs(workspaceRoot), options));
  const maxJobs = options.maxJobs ?? DEFAULT_MAX_STATUS_JOBS;
  const maxProgressLines = options.maxProgressLines ?? DEFAULT_MAX_PROGRESS_LINES;

  const running = jobs
    .filter((job) => job.status === "queued" || job.status === "running")
    .map((job) => enrichJob(job, { maxProgressLines }));

  const latestFinishedRaw = jobs.find((job) => job.status !== "queued" && job.status !== "running") ?? null;
  const latestFinished = latestFinishedRaw ? enrichJob(latestFinishedRaw, { maxProgressLines }) : null;

  const recent = (options.all ? jobs : jobs.slice(0, maxJobs))
    .filter((job) => job.status !== "queued" && job.status !== "running" && job.id !== latestFinished?.id)

View on GitHub (pinned to db52e28f4d)

Solutions

  1. Run /codex:status to see current valid job ids, then retry with a correct id.
  2. Confirm you are in the same repository/workspace where the job was created (resolveWorkspaceRoot).
  3. If the job was archived/rotated, start a new Codex job instead of referencing the old one.

Example fix

// before
resolveResultJob(cwd, "zzz999"); // stale/typo

// after
const { running, recent } = buildStatusSnapshot(cwd);
resolveResultJob(cwd, running[0]?.id ?? recent[0]?.id);
Defensive patterns

Strategy: validation

Validate before calling

function referenceExists(jobs, reference) {
  if (!reference) return jobs.length > 0;
  return jobs.some((j) => j.id === reference || j.id.startsWith(reference));
}

const jobs = listJobs(workspaceRoot);
if (!referenceExists(jobs, ref)) {
  throw new Error(`Unknown job '${ref}'. Known: ${jobs.map((j) => j.id).slice(0, 5).join(", ")}...`);
}

Try / catch

try {
  buildSingleJobSnapshot(cwd, ref);
} catch (err) {
  if (/No job found/.test(err.message)) {
    const snap = buildStatusSnapshot(cwd, { all: true });
    const fallback = snap.running[0] ?? snap.latestFinished ?? snap.recent[0];
    if (fallback) buildSingleJobSnapshot(cwd, fallback.id);
    else throw err;
  } else throw err;
}

Prevention

When it happens

Trigger: Passing a reference string to matchJobReference (via any caller) that matches no job id exactly or by prefix. E.g. a stale id from a previous session, a typo, or an id from a different workspace.

Common situations: Using a job id copied from another repo/session; the job file was deleted or rotated out; a typo in the id; the workspace root resolved differently so a different job set was listed.

Related errors


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