{"record":{"id":"9a19883a837b385f","repo":"openai/codex-plugin-cc","slug":"no-job-found-for-reference-run-codex-status-9a1988","errorCode":null,"errorMessage":"No job found for \"${reference}\". Run /codex:status to inspect known jobs.","messagePattern":"No job found for \"(.+?)\"\\. Run /codex:status to inspect known jobs\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/codex/scripts/lib/job-control.mjs","lineNumber":247,"sourceCode":"    .map((job) => enrichJob(job, { maxProgressLines }));\n\n  return {\n    workspaceRoot,\n    config,\n    sessionRuntime: getSessionRuntimeStatus(options.env, workspaceRoot),\n    running,\n    latestFinished,\n    recent,\n    needsReview: Boolean(config.stopReviewGate)\n  };\n}\n\nexport function buildSingleJobSnapshot(cwd, reference, options = {}) {\n  const workspaceRoot = resolveWorkspaceRoot(cwd);\n  const jobs = sortJobsNewestFirst(listJobs(workspaceRoot));\n  const selected = matchJobReference(jobs, reference);\n  if (!selected) {\n    throw new Error(`No job found for \"${reference}\". Run /codex:status to inspect known jobs.`);\n  }\n\n  return {\n    workspaceRoot,\n    job: enrichJob(selected, { maxProgressLines: options.maxProgressLines })\n  };\n}\n\nexport function resolveResultJob(cwd, reference) {\n  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) {","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/lib/job-control.mjs#L229-L265","documentation":"Thrown by buildSingleJobSnapshot() when matchJobReference returns null — i.e. a reference was given that matched nothing, OR no reference was given and the (unfiltered) job list is empty. Distinct from error 43: this fires from the single-job snapshot path and the recovery text says 'inspect known jobs'. Note matchJobReference only throws internally on ambiguity; for a plain miss it returns null, which this branch converts to an error.","triggerScenarios":"Calling buildSingleJobSnapshot(cwd, ref) with a non-matching ref, or buildSingleJobSnapshot(cwd) with no reference when zero jobs exist in the workspace. The path is used by the /codex:status <job> detail command.","commonSituations":"Inspecting a job id from a prior/rotated session; typo in the id; querying before any Codex job has ever run in this repo; pointing --root at the wrong directory.","solutions":["Run /codex:status (no arg) to enumerate known jobs and copy a valid id.","If no jobs are listed, start a Codex job first so there is something to inspect.","Verify the workspace root and that job state files exist under the jobs directory."],"exampleFix":"// before\nbuildSingleJobSnapshot(cwd, \"old-id\");\n\n// after\nconst snap = buildStatusSnapshot(cwd);\nconst validId = (snap.running[0] ?? snap.recent[0] ?? snap.latestFinished)?.id;\nif (validId) buildSingleJobSnapshot(cwd, validId);","handlingStrategy":"validation","validationCode":"function safeSingleJobSnapshot(cwd, reference) {\n  const jobs = listJobs(resolveWorkspaceRoot(cwd));\n  if (reference && !jobs.some((j) => j.id === reference || j.id.startsWith(reference))) {\n    return { error: 'not-found', knownIds: jobs.map((j) => j.id) };\n  }\n  if (!reference && jobs.length === 0) {\n    return { error: 'empty' };\n  }\n  return buildSingleJobSnapshot(cwd, reference);\n}","typeGuard":null,"tryCatchPattern":"try {\n  buildSingleJobSnapshot(cwd, ref);\n} catch (err) {\n  if (/No job found/.test(err.message)) {\n    buildStatusSnapshot(cwd, { all: true }); // show what exists\n  } else throw err;\n}","preventionTips":["Check buildStatusSnapshot output for known ids before drilling into a single job.","Confirm at least one job exists before calling with no reference.","Validate the id against the current job list to give a richer not-found message."],"tags":["job-control","not-found","codex","status"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}