{"record":{"id":"1e99aa314d979515","repo":"openai/codex-plugin-cc","slug":"no-active-codex-jobs-to-cancel-for-this-session","errorCode":null,"errorMessage":"No active Codex jobs to cancel for this session.","messagePattern":"No active Codex jobs to cancel for this session\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"plugins/codex/scripts/lib/job-control.mjs","lineNumber":304,"sourceCode":"  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\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":286,"sourceCodeEnd":309,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/lib/job-control.mjs#L286-L309","documentation":"Thrown by resolveCancelableJob() when no reference is supplied, the current session is identified (getCurrentSessionId returns truthy), and zero active jobs exist for that session. It is the session-scoped 'nothing to cancel' state, distinct from error 51 which is the repo-wide equivalent.","triggerScenarios":"Calling resolveCancelableJob(cwd) with session options set (so a session id is present) when no queued/running jobs belong to that session. Reached via bare /codex:cancel in a session where all jobs finished or none were started.","commonSituations":"Calling cancel after the session's only job finished; session id mismatch filtering out the active job; bare /codex:cancel reused from a session that has no live work.","solutions":["Run /codex:status to confirm there are no active jobs for this session (nothing to cancel).","If an active job exists but is attributed to a different session, pass its id explicitly to bypass session scoping.","Start a new job if cancellation was intended to interrupt live work."],"exampleFix":"// before\nresolveCancelableJob(cwd, null, { sessionId: \"sess-1\" }); // no active in sess-1\n\n// after\nconst snap = buildStatusSnapshot(cwd, { all: true });\nif (snap.running.length === 0) console.log(\"nothing to cancel\");\nelse resolveCancelableJob(cwd, snap.running[0].id);","handlingStrategy":"validation","validationCode":"function sessionHasActiveJobs(jobs, options) {\n  return filterJobsForCurrentSession(\n    jobs.filter((j) => [\"queued\", \"running\"].includes(j.status)),\n    options\n  ).length > 0;\n}\n\nif (!sessionHasActiveJobs(listJobs(workspaceRoot), options)) {\n  console.log(\"No active jobs for this session — nothing to cancel.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  resolveCancelableJob(cwd, null, options);\n} catch (err) {\n  if (/No active Codex jobs to cancel for this session/.test(err.message)) {\n    // benign: nothing to do; optionally check repo-wide\n    resolveCancelableJob(cwd, null, {});\n  } else throw err;\n}","preventionTips":["Guard the UI so cancel is only offered when the session has >=1 active job.","If an active job exists but is attributed to another session, pass its id explicitly.","Refresh /codex:status before cancelling to avoid stale 'no active' states."],"tags":["job-control","empty-state","codex","cancel","session"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}