openai/codex · error · Error
Unable to locate Codex CLI binaries for ${targetTriple}. Ens
Error message
Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies. What it means
Error "Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies." thrown in openai/codex.
Source
Thrown at sdk/typescript/src/exec.ts:419
throw new Error(`Unsupported target triple: ${targetTriple}`);
}
let vendorRoot: string;
try {
const codexPackageJsonPath = moduleRequire.resolve(`${CODEX_NPM_NAME}/package.json`);
const codexRequire = createRequire(codexPackageJsonPath);
const platformPackageJsonPath = codexRequire.resolve(`${platformPackage}/package.json`);
vendorRoot = path.join(path.dirname(platformPackageJsonPath), "vendor");
} catch {
throw new Error(
`Unable to locate Codex CLI binaries. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies.`,
);
}
const codexBinaryName = process.platform === "win32" ? "codex.exe" : "codex";
const nativePackage = resolveNativePackage(vendorRoot, targetTriple, codexBinaryName);
if (!nativePackage) {
throw new Error(
`Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies.`,
);
}
return nativePackage;
}
export function resolveNativePackage(
vendorRoot: string,
targetTriple: string,
codexBinaryName: string,
): CodexPathResolution | null {
const packageRoot = path.join(vendorRoot, targetTriple);
const packageBinaryPath = path.join(packageRoot, "bin", codexBinaryName);
if (isFile(packageBinaryPath) && isFile(path.join(packageRoot, "codex-package.json"))) {
return {
executablePath: packageBinaryPath,
pathDirs: existingDirs(path.join(packageRoot, "codex-path")),View on GitHub (pinned to 339751715c)
Solutions
- Reinstall the npm package with optional dependencies enabled so the binary for this target triple is installed.
When it happens
Trigger: Thrown at sdk/typescript/src/exec.ts:419 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/8537de7a6f5f13d6.
Report an issue: GitHub.