{"record":{"id":"d7642da9b6fb4d0b","repo":"slopus/happy","slug":"codex-cli-is-not-installed-please-install-codex-c","errorCode":null,"errorMessage":"Codex CLI is not installed\n\nPlease install Codex CLI using one of these methods:\n\nOption 1 - npm (recommended):\n  npm install -g @openai/codex\n\nOption 2 - Homebrew (macOS):\n  brew install --cask codex\n\nAlternatively, use Claude Code:\n  happy claude","messagePattern":"Codex CLI is not installed\n\nPlease install Codex CLI using one of these methods:\n\nOption 1 - npm \\(recommended\\):\n  npm install -g @openai/codex\n\nOption 2 - Homebrew \\(macOS\\):\n  brew install --cask codex\n\nAlternatively, use Claude Code:\n  happy claude","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/happy-cli/src/codex/codexAppServerClient.ts","lineNumber":599,"sourceCode":"                    this.extractTurnId(params),\n                    'completed',\n                    null,\n                    `${method}:final_answer`,\n                );\n            }\n            return true;\n        }\n\n        return method.startsWith('item/');\n    }\n\n    // ─── Lifecycle ──────────────────────────────────────────────\n\n    async connect(): Promise<void> {\n        if (this.connected) return;\n\n        if (!isAppServerAvailable()) {\n            throw new Error(\n                'Codex CLI is not installed\\n\\n' +\n                'Please install Codex CLI using one of these methods:\\n\\n' +\n                'Option 1 - npm (recommended):\\n  npm install -g @openai/codex\\n\\n' +\n                'Option 2 - Homebrew (macOS):\\n  brew install --cask codex\\n\\n' +\n                'Alternatively, use Claude Code:\\n  happy claude',\n            );\n        }\n\n        let command = 'codex';\n        let args = ['app-server', '--listen', 'stdio://'];\n        this.sandboxEnabled = false;\n\n        if (this.sandboxConfig?.enabled && process.platform !== 'win32') {\n            try {\n                this.sandboxCleanup = await initializeSandbox(this.sandboxConfig, process.cwd());\n                const wrapped = await wrapForMcpTransport('codex', ['app-server', '--listen', 'stdio://']);\n                command = wrapped.command;\n                args = wrapped.args;","sourceCodeStart":581,"sourceCodeEnd":617,"githubUrl":"https://github.com/slopus/happy/blob/b824cd0a4681d41af631a8e422a813873e4455b0/packages/happy-cli/src/codex/codexAppServerClient.ts#L581-L617","documentation":"CodexAppServerClient.connect() refuses to start when the Codex CLI app-server binary cannot be located on the machine (isAppServerAvailable() is false). The happy CLI shells out to the Codex CLI to run Codex sessions, so without the binary there is nothing to connect to. The message includes concrete install instructions and points to `happy claude` as the Claude Code alternative.","triggerScenarios":"Any code path that creates a CodexAppServerClient and calls connect() (directly or via withCodexAppServerClient, reconnect, reconnectAndResumeThread) on a machine where the Codex CLI is not installed or not on PATH.","commonSituations":"Fresh dev machines or CI containers without `@openai/codex` installed; Codex installed under a non-PATH location; switching from Claude-only usage to `happy codex`; broken Homebrew cask after an OS upgrade.","solutions":["Install Codex CLI: npm install -g @openai/codex (or brew install --cask codex on macOS)","Verify the binary is on PATH: `which codex` / `codex --version`","If already installed, fix PATH so the install prefix (e.g. npm global bin) is included","Use Claude Code instead: run `happy claude`"],"exampleFix":"// before\nhappy codex  // fails: Codex CLI is not installed\n\n// after\n$ npm install -g @openai/codex\n$ happy codex","handlingStrategy":"validation","validationCode":"import { execFileSync } from 'node:child_process';\nfunction isCodexCliAvailable(): boolean {\n  try { execFileSync('codex', ['--version'], { stdio: 'ignore' }); return true; }\n  catch { return false; }\n}\nif (!isCodexCliAvailable()) {\n  console.error('Install Codex CLI: npm install -g @openai/codex');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await client.connect();\n} catch (error) {\n  if ((error as Error).message.includes('Codex CLI is not installed')) {\n    console.error('Run `npm install -g @openai/codex` or use `happy claude`.');\n  } else { throw error; }\n}","preventionTips":["Check `codex --version` in setup scripts / CI before running happy codex","Document the Codex CLI as a prerequisite for Codex sessions","Keep the npm global bin directory on PATH"],"tags":["codex","cli","missing-binary","environment"],"backgroundTag":"missing-binary-dependency","analyzedSha":"b824cd0a4681d41af631a8e422a813873e4455b0","analyzedAt":"2026-08-31T23:12:36.205Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}