{"record":{"id":"9864054e794a3d2b","repo":"openai/codex-plugin-cc","slug":"codex-cli-is-not-installed-or-is-missing-required-986405","errorCode":null,"errorMessage":"Codex CLI is not installed or is missing required runtime support. Install it with `npm install -g @openai/codex`, then rerun `/codex:setup`.","messagePattern":"Codex CLI is not installed or is missing required runtime support\\. Install it with `npm install -g @openai/codex`, then rerun `/codex:setup`\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/codex/scripts/lib/codex.mjs","lineNumber":1005,"sourceCode":"      transport: client.transport,\n      detail: `Interrupted ${turnId} on ${threadId}.`\n    };\n  } catch (error) {\n    return {\n      attempted: true,\n      interrupted: false,\n      transport: client?.transport ?? null,\n      detail: error instanceof Error ? error.message : String(error)\n    };\n  } finally {\n    await client?.close().catch(() => {});\n  }\n}\n\nexport async function runAppServerReview(cwd, options = {}) {\n  const availability = getCodexAvailability(cwd);\n  if (!availability.available) {\n    throw new Error(\"Codex CLI is not installed or is missing required runtime support. Install it with `npm install -g @openai/codex`, then rerun `/codex:setup`.\");\n  }\n\n  return withAppServer(cwd, async (client) => {\n    emitProgress(options.onProgress, \"Starting Codex review thread.\", \"starting\");\n    const thread = await startThread(client, cwd, {\n      model: options.model,\n      sandbox: \"read-only\",\n      ephemeral: true,\n      threadName: options.threadName\n    });\n    const sourceThreadId = thread.thread.id;\n    emitProgress(options.onProgress, `Thread ready (${sourceThreadId}).`, \"starting\", {\n      threadId: sourceThreadId\n    });\n    const delivery = options.delivery ?? \"inline\";\n\n    const turnState = await captureTurn(\n      client,","sourceCodeStart":987,"sourceCodeEnd":1023,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/lib/codex.mjs#L987-L1023","documentation":"Thrown by runAppServerReview when getCodexAvailability(cwd).available is false. The availability check runs two probes: 'codex --version' (binary present) and 'codex app-server --help' (the app-server subcommand exists). If either fails, Codex cannot host the review thread and the command aborts with install guidance.","triggerScenarios":"Invoking runAppServerReview when the 'codex' binary is not on PATH, when 'codex --version' exits non-zero, or when an older Codex build lacks the 'app-server' subcommand (appServerStatus probe fails). getCodexAvailability returns {available:false} in all these cases.","commonSituations":"Codex CLI was never installed globally. A local/npx install is not on PATH in the current shell. An old pinned Codex version predates the app-server runtime. The codex binary exists but its Node runtime/helper is broken (e.g. missing node_modules after a partial install).","solutions":["Install or reinstall Codex globally: npm install -g @openai/codex.","Rerun /codex:setup so the plugin records the resolved binary path.","Confirm 'codex --version' and 'codex app-server --help' both succeed in the same shell/environment before retrying.","If using a non-global install, add its bin dir to PATH or point the plugin at the absolute binary path.","Upgrade an old build: npm install -g @openai/codex@latest."],"exampleFix":"// before\nawait runAppServerReview(cwd, { target }) // throws if codex missing\n\n// after (shell setup)\n//   npm install -g @openai/codex\n//   codex --version && codex app-server --help  # both must succeed\n//   /codex:setup\nawait runAppServerReview(cwd, { target })","handlingStrategy":"validation","validationCode":"import { getCodexAvailability } from './codex.mjs';\n\nasync function guardedReview(cwd, options) {\n  const avail = getCodexAvailability(cwd);\n  if (!avail.available) {\n    return { status: 'unavailable', detail: avail.detail };\n  }\n  return runAppServerReview(cwd, options);\n}","typeGuard":"null","tryCatchPattern":"try {\n  await runAppServerReview(cwd, options);\n} catch (e) {\n  if (/Codex CLI is not installed/.test(e.message)) {\n    // prompt user to install, then /codex:setup\n  } else throw e;\n}","preventionTips":["Run /codex:setup during onboarding to validate Codex availability up front.","Verify 'codex --version' and 'codex app-server --help' in CI before review jobs.","Pin a Codex version that includes app-server support.","Pre-check getCodexAvailability before launching long-running review flows."],"tags":["codex","dependency","install","runtime"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}