{"record":{"id":"3161571facfa9230","repo":"openai/codex-plugin-cc","slug":"job-active-id-is-still-active-status-check","errorCode":null,"errorMessage":"Job ${active.id} is still ${active.status}. Check /codex:status and try again once it finishes.","messagePattern":"Job (.+?) is still (.+?)\\. Check /codex:status and try again once it finishes\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"plugins/codex/scripts/lib/job-control.mjs","lineNumber":271,"sourceCode":"  };\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) {\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}\".`);","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/lib/job-control.mjs#L253-L289","documentation":"Thrown by resolveResultJob() when the requested job exists but is still in a queued or running state — there are no results to fetch yet. The function filters for finished jobs (completed|failed|cancelled) first; only if that misses but an active job matches does it emit this. It tells the user to wait for completion.","triggerScenarios":"Calling resolveResultJob(cwd, ref) where ref matches a job whose status is 'queued' or 'running'. Also reached via resolveResultJob(cwd) with no ref when the only matching job in the current session is still active.","commonSituations":"Polling for results immediately after launching a Codex job; a long-running job the user mistakenly believes finished; CI polling on a job that stalled.","solutions":["Wait for the job to finish, then retry (check /codex:status for status transitions).","If the job is stuck, cancel it with /codex:cancel then relaunch.","Poll status rather than results: use buildStatusSnapshot until status leaves queued|running."],"exampleFix":"// before\nresolveResultJob(cwd, jobId); // still running\n\n// after\n// poll until finished, then resolve results\nlet snap = buildSingleJobSnapshot(cwd, jobId);\n// (externally) wait for snap.job.status in completed|failed|cancelled\nresolveResultJob(cwd, jobId);","handlingStrategy":"retry","validationCode":"function isJobFinished(job) {\n  return [\"completed\", \"failed\", \"cancelled\"].includes(job.status);\n}\n\nconst snap = buildSingleJobSnapshot(cwd, jobId).job;\nif (!isJobFinished(snap)) {\n  throw new Error(`Job ${snap.id} is still ${snap.status}. Wait for completion.`);\n}\n// only now:\nresolveResultJob(cwd, jobId);","typeGuard":"function isFinishedJob(job) {\n  return job != null && [\"completed\", \"failed\", \"cancelled\"].includes(job.status);\n}","tryCatchPattern":"try {\n  resolveResultJob(cwd, jobId);\n} catch (err) {\n  if (/is still/.test(err.message)) {\n    // schedule a retry / poll status; do NOT spam resolveResultJob in a tight loop\n    console.error(err.message);\n  } else throw err;\n}","preventionTips":["Poll buildStatusSnapshot until the job reaches a terminal status before requesting results.","Do not call resolveResultJob in a busy loop; use a scheduled wake-up.","If a job appears stuck queued, consider cancelling and relaunching."],"tags":["job-control","state","codex","results"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}