affaan-m/ECC · error · Error

ENOENT

ENOENT

Error message

Codex CLI is not installed

What it means

probeCodex spawns the `codex` executable to probe version/features. When spawn fails with an ENOENT error code, it means the OS could not find the `codex` binary on PATH, so the script throws 'Codex CLI is not installed'. This is the dedicated friendly message for the missing-binary case, distinguished from other spawn errors by checking result.error.code.

Solutions

  1. Install the Codex CLI (npm install -g @openai/codex or per OpenAI's install docs).
  2. Verify with `which codex` / `command -v codex`; if absent, add its install dir to PATH.
  3. In CI, add an install step for the CLI before running this script.
  4. Open a new shell after installation so PATH changes take effect.

Example fix

// before
node review-with-codex.js --consent-to-openai
// Error: Codex CLI is not installed

// after
npm install -g @openai/codex
node review-with-codex.js --consent-to-openai
Defensive patterns

Strategy: try-catch

Validate before calling

const which = require('child_process').spawnSync('codex', ['--version'], { stdio: 'ignore' });
if (which.error || which.status !== 0) {
  throw new Error('codex CLI unavailable on PATH; install @openai/codex first');
}

Try / catch

try {
  runCodexReview(args);
} catch (e) {
  if (String(e.message) === 'Codex CLI is not installed') {
    console.error('Install the Codex CLI: npm i -g @openai/codex');
    process.exit(127);
  }
}

Prevention

When it happens

Trigger: Running review-with-codex.js on a machine where the OpenAI Codex CLI was never installed, where it was installed but not added to PATH, or inside a container/CI image lacking the binary. Called by versionText and featuresText.

Common situations: Fresh dev machine or new container without the CLI; installed via a manager that didn't update PATH in the current shell; running under a different user (e.g. CI service user) whose PATH differs; npx-installed tool not on PATH when invoked as `codex`.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/927c0a4ef071088c. Report an issue: GitHub.

Appendix: 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 8321021c54)