{"record":{"id":"eb7691e829052150","repo":"openai/codex-plugin-cc","slug":"no-finished-job-found-for-reference-run-cod","errorCode":null,"errorMessage":"No finished job found for \"${reference}\". Run /codex:status to inspect active jobs.","messagePattern":"No finished job found for \"(.+?)\"\\. Run /codex:status to inspect active jobs\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/codex/scripts/lib/job-control.mjs","lineNumber":275,"sourceCode":"  const workspaceRoot = resolveWorkspaceRoot(cwd);\n  const jobs = sortJobsNewestFirst(reference ? listJobs(workspaceRoot) : filterJobsForCurrentSession(listJobs(workspaceRoot)));\n  const selected = matchJobReference(\n    jobs,\n    reference,\n    (job) => job.status === \"completed\" || job.status === \"failed\" || job.status === \"cancelled\"\n  );\n\n  if (selected) {\n    return { workspaceRoot, job: selected };\n  }\n\n  const active = matchJobReference(jobs, reference, (job) => job.status === \"queued\" || job.status === \"running\");\n  if (active) {\n    throw new Error(`Job ${active.id} is still ${active.status}. Check /codex:status and try again once it finishes.`);\n  }\n\n  if (reference) {\n    throw new Error(`No finished job found for \"${reference}\". Run /codex:status to inspect active jobs.`);\n  }\n\n  throw new Error(\"No finished Codex jobs found for this repository yet.\");\n}\n\nexport function resolveCancelableJob(cwd, reference, options = {}) {\n  const workspaceRoot = resolveWorkspaceRoot(cwd);\n  const jobs = sortJobsNewestFirst(listJobs(workspaceRoot));\n  const activeJobs = jobs.filter((job) => job.status === \"queued\" || job.status === \"running\");\n\n  if (reference) {\n    const selected = matchJobReference(activeJobs, reference);\n    if (!selected) {\n      throw new Error(`No active job found for \"${reference}\".`);\n    }\n    return { workspaceRoot, job: selected };\n  }\n","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/lib/job-control.mjs#L257-L293","documentation":"Thrown by resolveResultJob() when a reference is supplied, no finished job matches it, AND no active job matches it either — the reference points to nothing in any lifecycle state. This is the reference-specific counterpart to error 47; it confirms the id is unknown rather than the repo being empty.","triggerScenarios":"Calling resolveResultJob(cwd, ref) where ref matches neither a finished job nor an active job. Reference is non-empty but resolves to nothing across the full job list.","commonSituations":"Stale id from a rotated/archived job log; typo; id from a different workspace; the job state file was manually deleted.","solutions":["Run /codex:status to find current active/finished jobs and retry with a valid id.","Confirm the reference is from this repo's job history.","If you need results for an old job, restore its job file or relaunch the work."],"exampleFix":"// before\nresolveResultJob(cwd, \"stale-id\");\n\n// after\n// pick the most recent finished job explicitly\nconst snap = buildStatusSnapshot(cwd, { all: true });\nresolveResultJob(cwd, snap.recent[0]?.id ?? snap.latestFinished?.id);","handlingStrategy":"validation","validationCode":"function hasFinishedJobForReference(jobs, reference) {\n  const finished = jobs.filter((j) => [\"completed\", \"failed\", \"cancelled\"].includes(j.status));\n  return finished.some((j) => j.id === reference || j.id.startsWith(reference));\n}\n\nconst jobs = listJobs(workspaceRoot);\nif (reference && !hasFinishedJobForReference(jobs, reference)) {\n  throw new Error(`No finished job for '${reference}'.`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  resolveResultJob(cwd, ref);\n} catch (err) {\n  if (/No finished job found/.test(err.message)) {\n    buildStatusSnapshot(cwd, { all: true }); // list what's there\n  } else throw err;\n}","preventionTips":["Confirm a job is in a terminal state via /codex:status before requesting its results.","Cache valid job ids right after they finish to avoid stale references.","Treat 'No finished job found' as a re-list trigger, not a retry of the same id."],"tags":["job-control","not-found","codex","results"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}