{"record":{"id":"a6f891a33d0b1e99","repo":"openai/codex-plugin-cc","slug":"no-active-codex-jobs-to-cancel","errorCode":null,"errorMessage":"No active Codex jobs to cancel.","messagePattern":"No active Codex jobs to cancel\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"plugins/codex/scripts/lib/job-control.mjs","lineNumber":307,"sourceCode":"      throw new Error(`No active job found for \"${reference}\".`);\n    }\n    return { workspaceRoot, job: selected };\n  }\n\n  const sessionScopedActiveJobs = filterJobsForCurrentSession(activeJobs, options);\n\n  if (sessionScopedActiveJobs.length === 1) {\n    return { workspaceRoot, job: sessionScopedActiveJobs[0] };\n  }\n  if (sessionScopedActiveJobs.length > 1) {\n    throw new Error(\"Multiple Codex jobs are active. Pass a job id to /codex:cancel.\");\n  }\n\n  if (getCurrentSessionId(options)) {\n    throw new Error(\"No active Codex jobs to cancel for this session.\");\n  }\n\n  throw new Error(\"No active Codex jobs to cancel.\");\n}\n","sourceCodeStart":289,"sourceCodeEnd":309,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/lib/job-control.mjs#L289-L309","documentation":"Thrown by resolveCancelableJob() when no reference is supplied, no session id is present (getCurrentSessionId falsy), and there are zero active jobs repo-wide. It is the global 'nothing to cancel' terminal state — the broadest of the cancel not-found errors.","triggerScenarios":"Calling resolveCancelableJob(cwd) with no reference and no session context when the entire job list has no queued or running jobs. Bare /codex:cancel outside any session with nothing live.","commonSituations":"Calling cancel before any job was started; all jobs already finished; running in an environment where session id is unavailable so session scoping is skipped and the global set is empty.","solutions":["Run /codex:status to verify there are no active jobs (nothing to cancel).","Start a Codex job first if cancellation was expected to interrupt work.","If you believe a job is hung, confirm via /codex:status that it is still tracked as active."],"exampleFix":"// before\nresolveCancelableJob(cwd); // nothing active repo-wide\n\n// after\nconst snap = buildStatusSnapshot(cwd);\nif (snap.running.length === 0) {\n  console.log(\"No active jobs to cancel.\");\n} else {\n  resolveCancelableJob(cwd, snap.running[0].id);\n}","handlingStrategy":"validation","validationCode":"function repoHasActiveJobs(jobs) {\n  return jobs.some((j) => [\"queued\", \"running\"].includes(j.status));\n}\n\nif (!repoHasActiveJobs(listJobs(workspaceRoot))) {\n  console.log(\"No active jobs repo-wide — nothing to cancel.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  resolveCancelableJob(cwd);\n} catch (err) {\n  if (/No active Codex jobs to cancel/.test(err.message)) {\n    console.log(err.message); // benign terminal state\n  } else throw err;\n}","preventionTips":["Offer cancel only when /codex:status shows running/queued jobs.","Confirm a job is truly hung (not finished) before attempting cancellation.","Track launched jobs in the caller so you know whether any are live."],"tags":["job-control","empty-state","codex","cancel"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}