affaan-m/ECC · error · Error

Codex CLI is not installed

Error message

Codex CLI is not installed

What it means

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.

Source

Thrown at skills/council-multi-model/scripts/review-with-codex.js:119

    '--ignore-rules',
    '--strict-config',
    '--skip-git-repo-check',
    '--sandbox', 'read-only',
    '--cd', tempDir,
    '--color', 'never',
    '--config', 'shell_environment_policy.inherit="none"',
    '--config', 'skills.include_instructions=false',
    '--config', 'web_search="disabled"',
    '--config', 'mcp_servers={}',
    '--output-last-message', outputFile,
    '-',
  ];
}

function probeCodex(spawn, args, options, label) {
  const result = spawn('codex', args, options);
  if (result.error) {
    if (result.error.code === 'ENOENT') throw new Error('Codex CLI is not installed');
    throw new Error(`Codex ${label} probe failed: ${result.error.message}`);
  }
  if (result.status !== 0) {
    const detail = (result.stderr || '').trim().split('\n').slice(-1)[0];
    throw new Error(`Codex ${label} probe failed${detail ? `: ${detail}` : ''}`);
  }
  return (result.stdout || '').trim();
}

function verifyToollessSupport(dependencies = {}) {
  const spawn = dependencies.spawnSync || spawnSync;
  const options = {
    cwd: os.tmpdir(),
    env: buildEnvironment(dependencies.env || process.env),
    encoding: 'utf8',
    timeout: 5_000,
    maxBuffer: 256 * 1024,
    windowsHide: true,

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Install the Codex CLI and verify with `codex --version` from the same shell.
  2. Ensure the codex binary directory is on PATH and that PATH is forwarded into the spawn env (buildEnvironment allowlists it).
  3. If Codex is intentionally unavailable, skip this review path rather than retrying.

Example fix

// before: codex not installed
$ codex --version
bash: codex: command not found

// after
$ npm install -g @openai/codex  # or the project's documented install step
$ codex --version
codex-cli 0.146.0
Defensive patterns

Strategy: type-guard

Validate before calling

function codexAvailable(spawnSync) {
  const r = spawnSync('codex', ['--version'], { encoding: 'utf8', timeout: 5000 });
  return !(r.error && r.error.code === 'ENOENT');
}
// call before runReview; surface a friendly install hint if false

Type guard

function isCodexInstalled(spawnSync) {
  const r = spawnSync('codex', ['--version'], { encoding: 'utf8', timeout: 5000 });
  return !r.error || r.error.code !== 'ENOENT';
}

Try / catch

try {
  runReview(prompt, options);
} catch (error) {
  if (/Codex CLI is not installed/.test(error.message)) {
    console.error('Install the Codex CLI, then re-run.');
    process.exit(2);
  }
  throw error;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/108b8118b2fcf919. Report an issue: GitHub.