{"record":{"id":"ab225f8fadd8e25e","repo":"affaan-m/ECC","slug":"codex-invocation-failed-result-error-message","errorCode":null,"errorMessage":"Codex invocation failed: ${result.error.message}","messagePattern":"Codex invocation failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skills/council-multi-model/scripts/review-with-codex.js","lineNumber":215,"sourceCode":"  const remove = dependencies.rmSync || fs.rmSync;\n  const tempDir = makeTemp(path.join(os.tmpdir(), 'ecc-council-review-'));\n  const outputFile = path.join(tempDir, 'last-message.txt');\n\n  try {\n    const result = spawn('codex', buildCodexArgs(tempDir, outputFile), {\n      cwd: tempDir,\n      env: environment,\n      input: prompt,\n      encoding: 'utf8',\n      timeout: options.timeoutMs,\n      maxBuffer: 1024 * 1024,\n      windowsHide: true,\n    });\n\n    if (result.error) {\n      if (result.error.code === 'ETIMEDOUT') throw new Error('Codex review timed out');\n      if (result.error.code === 'ENOENT') throw new Error('Codex CLI is not installed');\n      throw new Error(`Codex invocation 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 review failed${detail ? `: ${detail}` : ''}`);\n    }\n\n    let text;\n    try {\n      text = readFile(outputFile, 'utf8').trim();\n    } catch (error) {\n      throw new Error(`Codex returned no final response: ${error.message}`);\n    }\n    if (!text) throw new Error('Codex returned an empty final response');\n    return `${providerLabel(options.hostProvider)}\\n${text}`;\n  } finally {\n    remove(tempDir, { recursive: true, force: true });\n  }\n}","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/skills/council-multi-model/scripts/review-with-codex.js#L197-L233","documentation":"Thrown by runReview when spawning codex failed with a spawn error other than ETIMEDOUT/ENOENT during the actual review run. The underlying spawn error message is embedded.","triggerScenarios":"Triggered when review-with-codex.js rejects the current invocation: Codex invocation failed: <value>","commonSituations":"Occurs while running skills/council-multi-model/scripts/review-with-codex.js with invalid arguments, missing flags, or a failing external dependency; the guard at skills/council-multi-model/scripts/review-with-codex.js:215 aborts the command with this message.","solutions":["Inspect the underlying error detail in the message (stderr/log/HTTP status), fix the cause, and retry."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06c5e118c4d3e6c3b7f9445f973a2194c82de193","analyzedAt":"2026-08-18T11:27:13.915Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}