Yeachan-Heo/oh-my-codex · critical · Error
failed to launch codex login: executable not found in PATH
Error message
failed to launch codex login: executable not found in PATH
What it means
`omx auth add` spawns the `codex` CLI to perform login. When the spawn error classifies as 'missing' (ENOENT), it means no `codex` executable was found on PATH. The wrapper cannot authenticate without the underlying codex binary installed.
Source
Thrown at src/cli/auth.ts:50
for (const arg of args) {
if (!allowed.has(arg)) {
throw new Error(`unsupported codex login flag for omx auth add: ${arg}`);
}
}
}
function runCodexLogin(cwd: string, env: NodeJS.ProcessEnv, loginArgs: string[] = []): void {
validateCodexLoginArgs(loginArgs);
const { result } = spawnPlatformCommandSync("codex", ["login", ...loginArgs], {
cwd,
env,
stdio: "inherit",
encoding: "utf-8",
});
if (result.error) {
const error = result.error as NodeJS.ErrnoException;
const kind = classifySpawnError(error);
if (kind === "missing") throw new Error("failed to launch codex login: executable not found in PATH");
if (kind === "blocked") throw new Error(`failed to launch codex login: executable is blocked (${error.code || "blocked"})`);
throw error;
}
if (result.status !== 0) {
throw new Error(`codex login exited with code ${result.status ?? 1}`);
}
}
async function fileExists(path: string): Promise<boolean> {
try {
await readFile(path);
return true;
} catch (error) {
if ((error as NodeJS.ErrnoException).code === "ENOENT") return false;
throw error;
}
}
async function createIsolatedLoginCodexHome(home: string | undefined): Promise<string> {View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Install the codex CLI (e.g. `npm i -g @openai/codex` or the official installer)
- Verify with `which codex` / `codex --version` in the same shell you run omx from
- Fix PATH in CI/container so the codex install location is included
- If codex is installed at a non-standard location, symlink it into a PATH dir or export PATH before running omx
Example fix
# before omx auth add work --device-auth # codex: not found # after npm i -g @openai/codex omx auth add work --device-auth
Defensive patterns
Strategy: validation
Validate before calling
import { execFileSync } from 'node:child_process';
let hasCodex = false;
try { execFileSync('codex', ['--version'], { stdio: 'ignore' }); hasCodex = true; } catch {}
if (!hasCodex) throw new Error('codex CLI not installed/on PATH'); Try / catch
catch (e) { if (/executable not found in PATH/.test(String(e))) { await installCodex(); retry(); } else throw e; } Prevention
- Install codex before running omx auth add in setup scripts
- Assert `command -v codex` in CI preflight
- Initialize nvm/asdf shims in CI shells
When it happens
Trigger: Running `omx auth add <slot> ...` on a machine where the codex CLI is not installed, not on PATH in the current shell/CI, or where PATH is broken inside containers or GUI-launched terminals.
Common situations: Fresh machines without codex; nvm/asdf shims not initialized in CI; Docker images omitting codex; VS Code integrated terminal with different PATH than login shell.
Related errors
- failed to launch codex login: executable is blocked (${error
- [api] failed to launch native binary: executable not found (
- unsupported codex login flag for omx auth add: ${arg}
- codex login exited with code ${result.status ?? 1}
- [sparkshell] raw fallback failed: executable not found (${in
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/769f5a42ecc26024.
Report an issue: GitHub.