affaan-m/ECC · error · Error

Codex review failed${detail ? `: ${detail}` : ''}

Error message

Codex review failed${detail ? `: ${detail}` : ''}

What it means

When the codex subprocess spawns successfully but exits with a non-zero status, runReview treats it as a review failure. It takes the last non-empty line of stderr and appends it as detail (': <last stderr line>') to aid diagnosis. This covers policy refusals, sandbox violations, auth errors, and config problems that don't crash the spawn itself.

Source

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

  try {
    const result = spawn('codex', buildCodexArgs(tempDir, outputFile), {
      cwd: tempDir,
      env: environment,
      input: prompt,
      encoding: 'utf8',
      timeout: options.timeoutMs,
      maxBuffer: 1024 * 1024,
      windowsHide: true,
    });

    if (result.error) {
      if (result.error.code === 'ETIMEDOUT') throw new Error('Codex review timed out');
      if (result.error.code === 'ENOENT') throw new Error('Codex CLI is not installed');
      throw new Error(`Codex invocation failed: ${result.error.message}`);
    }
    if (result.status !== 0) {
      const detail = (result.stderr || '').trim().split('\n').slice(-1)[0];
      throw new Error(`Codex review failed${detail ? `: ${detail}` : ''}`);
    }

    let text;
    try {
      text = readFile(outputFile, 'utf8').trim();
    } catch (error) {
      throw new Error(`Codex returned no final response: ${error.message}`);
    }
    if (!text) throw new Error('Codex returned an empty final response');
    return `${providerLabel(options.hostProvider)}\n${text}`;
  } finally {
    remove(tempDir, { recursive: true, force: true });
  }
}

function runStdinReview(options, dependencies = {}) {
  const stdin = dependencies.stdin || process.stdin;
  const stdout = dependencies.stdout || process.stdout;

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Read the appended stderr detail in the error message for the specific failure.
  2. Reproduce manually: run `codex` with the same args (see buildCodexArgs) and the same packet to see full stderr.
  3. Verify Codex auth/CODEX_HOME is set up and that the installed version is exactly 0.146.0.
  4. If a sandbox/policy rule is the cause, confirm the review packet does not require disallowed access.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  return runReview(packet, options);
} catch (error) {
  if (error.message.startsWith('Codex review failed')) {
    // error.message already carries the last stderr line; surface it to the caller
    log.error('codex non-zero exit', { detail: error.message });
  }
  throw error;
}

Prevention

When it happens

Trigger: result.error is null/undefined but result.status !== 0 after the codex exec run. E.g. codex rejects the prompt under --sandbox read-only, --strict-config, or --ignore-rules; auth/credentials invalid; ephemeral constraints violated.

Common situations: CODEX_HOME/auth not configured; codex policy rejecting the content; a codex version whose flags differ from the supported 0.146.0; sandbox blocking a needed read; rate limit or quota returning non-zero.

Related errors


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