openai/codex · error · Error

Unable to locate Codex CLI binaries for

Error message

Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies.

What it means

The platform package resolved for the detected target triple, but the expected vendor directory/binary underneath it does not exist. The package is present yet incomplete, so the codex binary path cannot be returned for this triple.

Solutions

  1. Reinstall the npm package with optional dependencies enabled so the binary for this target triple is installed.
Defensive patterns

Strategy: fallback

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.

Appendix: 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)