{"record":{"id":"d7e81da5c8707ebd","repo":"affaan-m/ECC","slug":"codex-label-probe-failed-detail-detail","errorCode":null,"errorMessage":"Codex ${label} probe failed${detail ? `: ${detail}` : ''}","messagePattern":"Codex (.+?) probe failed(.+?)` : ''\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skills/council-multi-model/scripts/review-with-codex.js","lineNumber":124,"sourceCode":"    '--color', 'never',\n    '--config', 'shell_environment_policy.inherit=\"none\"',\n    '--config', 'skills.include_instructions=false',\n    '--config', 'web_search=\"disabled\"',\n    '--config', 'mcp_servers={}',\n    '--output-last-message', outputFile,\n    '-',\n  ];\n}\n\nfunction probeCodex(spawn, args, options, label) {\n  const result = spawn('codex', args, options);\n  if (result.error) {\n    if (result.error.code === 'ENOENT') throw new Error('Codex CLI is not installed');\n    throw new Error(`Codex ${label} probe 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 ${label} probe failed${detail ? `: ${detail}` : ''}`);\n  }\n  return (result.stdout || '').trim();\n}\n\nfunction verifyToollessSupport(dependencies = {}) {\n  const spawn = dependencies.spawnSync || spawnSync;\n  const options = {\n    cwd: os.tmpdir(),\n    env: buildEnvironment(dependencies.env || process.env),\n    encoding: 'utf8',\n    timeout: 5_000,\n    maxBuffer: 256 * 1024,\n    windowsHide: true,\n  };\n  const versionText = probeCodex(spawn, ['--version'], options, 'version');\n  const versionMatch = versionText.match(/^codex-cli\\s+([^\\s]+)$/m);\n  if (!versionMatch) {\n    throw new Error('Codex version could not be verified for tool-less review');","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/skills/council-multi-model/scripts/review-with-codex.js#L106-L142","documentation":"Thrown by probeCodex() in two cases: (a) spawnSync('codex', ...) returned a non-ENOENT spawn error (label is interpolated into the message along with result.error.message), or (b) codex exited with a non-zero status, in which case the last line of stderr is appended as detail. label is 'version' when probing `codex --version` and 'feature' when probing `codex features list`.","triggerScenarios":"codex exists on PATH but crashes or exits non-zero during `codex --version` or `codex features list`; a spawn-level error other than ENOENT (e.g. EACCES if the binary is not executable, or a permissions error). The detail string is the last non-empty stderr line, so the underlying cause is surfaced.","commonSituations":"Codex installed but misconfigured (bad config file, missing auth); a broken codex build that crashes on --version; permissions on the binary; an OS/arch mismatch where the binary fails to launch.","solutions":["Run the failing probe by hand to see full output: `codex --version` and `codex features list`.","Read the last stderr line cited in the error message for the root cause.","Reinstall or repair the Codex CLI; fix config/auth if the probe reports a config error.","If the binary is not executable, chmod +x or reinstall."],"exampleFix":"// before: error 'Codex version probe failed: permission denied'\n$ codex --version\nbash: codex: Permission denied\n\n// after\n$ chmod +x $(which codex)\n$ codex --version\ncodex-cli 0.146.0","handlingStrategy":"try-catch","validationCode":"function probeCodexSafe(spawnSync, args) {\n  const r = spawnSync('codex', args, { encoding: 'utf8', timeout: 5000 });\n  if (r.error) return { ok: false, kind: r.error.code || 'spawn-error', message: r.error.message };\n  if (r.status !== 0) return { ok: false, kind: 'nonzero', message: (r.stderr || '').trim().split('\\n').pop() };\n  return { ok: true, stdout: (r.stdout || '').trim() };\n}","typeGuard":"function isHealthyProbe(result) {\n  return Boolean(result && !result.error && result.status === 0);\n}","tryCatchPattern":"try {\n  verifyToollessSupport({ spawnSync });\n} catch (error) {\n  if (/^Codex (version|feature) probe failed/.test(error.message)) {\n    // inspect the trailing detail, repair codex install/config, then retry once\n  } else {\n    throw error;\n  }\n}","preventionTips":["Run `codex --version` and `codex features list` by hand to see full output before automating.","Keep the Codex CLI healthy (no broken config, valid auth) so probes exit 0.","Make sure the binary is executable and matches the host OS/arch."],"tags":["runtime","environment","codex","spawn","probe-failed"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}