{"record":{"id":"305b2d3f2d47643e","repo":"stablyai/orca","slug":"packaged-node-pty-has-no-conpty-payload-for-win10","errorCode":null,"errorMessage":"Packaged node-pty has no ConPTY payload for win10-${windowsArch}","messagePattern":"Packaged node-pty has no ConPTY payload for win10-(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"config/packaged-runtime-node-modules.cjs","lineNumber":311,"sourceCode":"    }\n  }\n}\n\nfunction findNodePtyConptySourceDir(nodePtyDir, windowsArch) {\n  const conptyRoot = join(nodePtyDir, 'third_party', 'conpty')\n  if (!existsSync(conptyRoot)) {\n    throw new Error(`Packaged node-pty is missing ${conptyRoot}`)\n  }\n  for (const entry of readdirSync(conptyRoot, { withFileTypes: true })) {\n    if (!entry.isDirectory()) {\n      continue\n    }\n    const sourceDir = join(conptyRoot, entry.name, `win10-${windowsArch}`)\n    if (existsSync(sourceDir)) {\n      return sourceDir\n    }\n  }\n  throw new Error(`Packaged node-pty has no ConPTY payload for win10-${windowsArch}`)\n}\n\nfunction ensurePackagedNodePtyConptyRuntime(nodePtyDir, electronArch) {\n  const releaseDir = join(nodePtyDir, 'build', 'Release')\n  if (!existsSync(join(releaseDir, 'conpty.node'))) {\n    return\n  }\n\n  const runtimeDir = join(releaseDir, 'conpty')\n  const missingRuntimeFiles = NODE_PTY_CONPTY_RUNTIME_FILES.filter(\n    (filename) => !existsSync(join(runtimeDir, filename))\n  )\n  if (missingRuntimeFiles.length === 0) {\n    return\n  }\n\n  const windowsArch = normalizeNodePtyWindowsArch(electronArch)\n  const sourceDir = findNodePtyConptySourceDir(nodePtyDir, windowsArch)","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/packaged-runtime-node-modules.cjs#L293-L329","documentation":"Thrown by findNodePtyConptySourceDir when node-pty/third_party/conpty exists but none of its subdirectories contains a win10-<windowsArch> folder matching the build's target architecture (x64 or arm64). The packager walks each vendor subdirectory looking for win10-x64 or win10-arm64 and falls through to this error if none matches.","triggerScenarios":"electronArch resolves to arm64 but the installed node-pty prebuild only ships win10-x64 (or vice versa); a cross-arch Windows build (e.g. arm64 on an x64 host) was attempted without the matching prebuild artifact; the conpty vendor directory was partially pruned so only one arch remains.","commonSituations":"Building Windows arm64 from a CI image that only cached x64 prebuilds; mixing a custom electronArch string with a prebuild that does not match; node-pty prebuilds fetched for the host arch instead of the target arch during install.","solutions":["Install node-pty prebuilds for the target arch: set npm_config_target_arch or use --target_arch=<arch> when running the install/rebuild so win10-<arch> is fetched.","Inspect node_modules/node-pty/third_party/conpty/*/ to see which win10-* directories actually exist, then align electronArch to one of them.","For arm64 Windows builds, ensure the install ran on a toolchain that emits arm64 prebuilds (or download the arm64 prebuilt tarball).","If only one arch is realistically supported, gate the build matrix so electronArch cannot request the missing arch."],"exampleFix":"// before — arm64 build with only x64 prebuilds present\n// electron-builder --win --arm64\n\n// after — install the arm64 prebuild first\n// npm_config_target_arch=arm64 pnpm rebuild node-pty\n// electron-builder --win --arm64","handlingStrategy":"validation","validationCode":"const { existsSync, readdirSync } = require('node:fs')\nconst { join } = require('node:path')\n\nfunction assertConptyArchPresent(nodePtyDir, arch) {\n  const conptyRoot = join(nodePtyDir, 'third_party', 'conpty')\n  const found = existsSync(conptyRoot) && readdirSync(conptyRoot, { withFileTypes: true })\n    .filter((e) => e.isDirectory())\n    .some((e) => existsSync(join(conptyRoot, e.name, `win10-${arch}`)))\n  if (!found) {\n    throw new Error(`No win10-${arch} ConPTY prebuild; install with npm_config_target_arch=${arch}`)\n  }\n}\n// call before packaging for win32:\n// assertConptyArchPresent(nodePtyDir, normalizeNodePtyWindowsArch(electronArch))","typeGuard":null,"tryCatchPattern":"try {\n  findNodePtyConptySourceDir(nodePtyDir, windowsArch)\n} catch (error) {\n  if (/no ConPTY payload for win10-/.test(error.message)) {\n    throw new Error(`${error.message} Reinstall node-pty with npm_config_target_arch=${windowsArch}.`)\n  }\n  throw error\n}","preventionTips":["Always set npm_config_target_arch to match the electron-builder target arch before installing node-pty.","Add a CI check that asserts the win10-<arch> directory exists before the package step.","Keep the build matrix honest: do not allow arm64 packaging from an image that only fetched x64 prebuilds."],"tags":["node-pty","packaging","windows","architecture","conpty","arm64"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}