{"record":{"id":"108b8118b2fcf919","repo":"affaan-m/ECC","slug":"codex-cli-is-not-installed","errorCode":null,"errorMessage":"Codex CLI is not installed","messagePattern":"Codex CLI is not installed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skills/council-multi-model/scripts/review-with-codex.js","lineNumber":119,"sourceCode":"    '--ignore-rules',\n    '--strict-config',\n    '--skip-git-repo-check',\n    '--sandbox', 'read-only',\n    '--cd', tempDir,\n    '--color', 'never',\n    '--config', 'shell_environment_policy.inherit=\"none\"',\n    '--config', 'skills.include_instructions=false',\n    '--config', 'web_search=\"disabled\"',\n    '--config', 'mcp_servers={}',\n    '--output-last-message', outputFile,\n    '-',\n  ];\n}\n\nfunction probeCodex(spawn, args, options, label) {\n  const result = spawn('codex', args, options);\n  if (result.error) {\n    if (result.error.code === 'ENOENT') throw new Error('Codex CLI is not installed');\n    throw new Error(`Codex ${label} probe failed: ${result.error.message}`);\n  }\n  if (result.status !== 0) {\n    const detail = (result.stderr || '').trim().split('\\n').slice(-1)[0];\n    throw new Error(`Codex ${label} probe failed${detail ? `: ${detail}` : ''}`);\n  }\n  return (result.stdout || '').trim();\n}\n\nfunction verifyToollessSupport(dependencies = {}) {\n  const spawn = dependencies.spawnSync || spawnSync;\n  const options = {\n    cwd: os.tmpdir(),\n    env: buildEnvironment(dependencies.env || process.env),\n    encoding: 'utf8',\n    timeout: 5_000,\n    maxBuffer: 256 * 1024,\n    windowsHide: true,","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/skills/council-multi-model/scripts/review-with-codex.js#L101-L137","documentation":"Thrown by probeCodex() when spawnSync('codex', ...) returns an error object whose code is 'ENOENT', meaning the `codex` executable could not be found on PATH. The review script shells out to the Codex CLI for the actual critique, so a missing binary is fatal before any review runs.","triggerScenarios":"Invoking review-with-codex.js on a machine where the Codex CLI is not installed, not on PATH, or where the build environment strips PATH (e.g. a locked-down container). buildEnvironment() only forwards a whitelist of env vars (PATH, HOME, USERPROFILE, CODEX_HOME, temp dirs, Windows vars), so a PATH that is set but not forwarded is also effectively empty.","commonSituations":"Fresh CI runner without Codex installed; local dev where codex was installed under a different name or in a non-PATH directory; a spawn env where PATH was not allowlisted through buildEnvironment.","solutions":["Install the Codex CLI and verify with `codex --version` from the same shell.","Ensure the codex binary directory is on PATH and that PATH is forwarded into the spawn env (buildEnvironment allowlists it).","If Codex is intentionally unavailable, skip this review path rather than retrying."],"exampleFix":"// before: codex not installed\n$ codex --version\nbash: codex: command not found\n\n// after\n$ npm install -g @openai/codex  # or the project's documented install step\n$ codex --version\ncodex-cli 0.146.0","handlingStrategy":"type-guard","validationCode":"function codexAvailable(spawnSync) {\n  const r = spawnSync('codex', ['--version'], { encoding: 'utf8', timeout: 5000 });\n  return !(r.error && r.error.code === 'ENOENT');\n}\n// call before runReview; surface a friendly install hint if false","typeGuard":"function isCodexInstalled(spawnSync) {\n  const r = spawnSync('codex', ['--version'], { encoding: 'utf8', timeout: 5000 });\n  return !r.error || r.error.code !== 'ENOENT';\n}","tryCatchPattern":"try {\n  runReview(prompt, options);\n} catch (error) {\n  if (/Codex CLI is not installed/.test(error.message)) {\n    console.error('Install the Codex CLI, then re-run.');\n    process.exit(2);\n  }\n  throw error;\n}","preventionTips":["Verify `codex --version` works in the same shell/env before invoking the script.","Ensure the codex binary directory is on PATH and that PATH is forwarded into the spawn env.","In CI, install Codex as an explicit setup step."],"tags":["runtime","environment","codex","dependency-missing","enoent","spawn"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}