{"record":{"id":"8537de7a6f5f13d6","repo":"openai/codex","slug":"unable-to-locate-codex-cli-binaries-for-targettr","errorCode":null,"errorMessage":"Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies.","messagePattern":"Unable to locate Codex CLI binaries for (.+?)\\. Ensure (.+?) is installed with optional dependencies\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"sdk/typescript/src/exec.ts","lineNumber":419,"sourceCode":"    throw new Error(`Unsupported target triple: ${targetTriple}`);\n  }\n\n  let vendorRoot: string;\n  try {\n    const codexPackageJsonPath = moduleRequire.resolve(`${CODEX_NPM_NAME}/package.json`);\n    const codexRequire = createRequire(codexPackageJsonPath);\n    const platformPackageJsonPath = codexRequire.resolve(`${platformPackage}/package.json`);\n    vendorRoot = path.join(path.dirname(platformPackageJsonPath), \"vendor\");\n  } catch {\n    throw new Error(\n      `Unable to locate Codex CLI binaries. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies.`,\n    );\n  }\n\n  const codexBinaryName = process.platform === \"win32\" ? \"codex.exe\" : \"codex\";\n  const nativePackage = resolveNativePackage(vendorRoot, targetTriple, codexBinaryName);\n  if (!nativePackage) {\n    throw new Error(\n      `Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies.`,\n    );\n  }\n\n  return nativePackage;\n}\n\nexport function resolveNativePackage(\n  vendorRoot: string,\n  targetTriple: string,\n  codexBinaryName: string,\n): CodexPathResolution | null {\n  const packageRoot = path.join(vendorRoot, targetTriple);\n  const packageBinaryPath = path.join(packageRoot, \"bin\", codexBinaryName);\n  if (isFile(packageBinaryPath) && isFile(path.join(packageRoot, \"codex-package.json\"))) {\n    return {\n      executablePath: packageBinaryPath,\n      pathDirs: existingDirs(path.join(packageRoot, \"codex-path\")),","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/sdk/typescript/src/exec.ts#L401-L437","documentation":"Error \"Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies.\" thrown in openai/codex.","triggerScenarios":"Thrown at sdk/typescript/src/exec.ts:419 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reinstall the npm package with optional dependencies enabled so the binary for this target triple is installed."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}