affaan-m/ECC · error · Error

Codex probe failed

Error message

Codex ${label} probe failed: ${result.error.message}

What it means

probeCodex catches any spawn error that is not ENOENT and rethrows it wrapped as `Codex <label> probe failed: <message>`. The label ('version' or 'features') identifies which probe failed. This covers all non-missing-binary spawn failures such as permission problems (EACCES), or the process failing to launch for OS reasons.

Solutions

  1. Read the wrapped message after the colon — it names the underlying OS error (e.g. EACCES) and fix that cause.
  2. If it's a permission problem, run `chmod +x $(which codex)` or reinstall the CLI.
  3. Reinstall the Codex CLI cleanly to repair a broken install.
  4. Check that no noexec mount or security policy is blocking execution of the binary.
  5. If ENOENT-like behavior occurs, confirm with `which codex` that the right binary is being resolved.

Example fix

// before
$ review-with-codex.js --consent-to-openai
// Error: Codex version probe failed: spawn EACCES

// after
chmod +x $(which codex)
$ review-with-codex.js --consent-to-openai   // proceeds
Defensive patterns

Strategy: try-catch

Validate before calling

const probe = require('child_process').spawnSync('codex', ['--version']);
if (probe.error && probe.error.code !== 'ENOENT') {
  throw new Error(`codex binary unusable: ${probe.error.message} (check permissions/reinstall)`);
}

Try / catch

try {
  runCodexReview(args);
} catch (e) {
  const m = /^Codex (\w+) probe failed: (.+)$/.exec(String(e.message));
  if (m) {
    console.error(`codex ${m[1]} probe failed at OS level: ${m[2]}`);
  }
}

Prevention

When it happens

Trigger: Spawning `codex` when result.error is set with a code other than ENOENT: the binary exists but is not executable (EACCES), the executable format is wrong, spawn hits an OS-level limit, or a platform-specific spawn failure occurs.

Common situations: codex installed but lacking +x permission (e.g. copied manually or restored from backup with lost permissions); a broken/partial install; a `codex` shim on PATH pointing to a corrupt binary; running on a filesystem mounted noexec.

Related errors


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

Appendix: source

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

    '--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)