{"record":{"id":"ca8a48221a4a56f4","repo":"stablyai/orca","slug":"node-pty-has-no-conpty-runtime-payload-for-win10","errorCode":null,"errorMessage":"node-pty has no ConPTY runtime payload for win10-${rebuildArch}","messagePattern":"node-pty has no ConPTY runtime payload for win10-(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/rebuild-native-deps.mjs","lineNumber":183,"sourceCode":"  process.exit(1)\n}\n\nfunction restoreNodePtyWindowsConptyRuntime() {\n  if (rebuildPlatform !== 'win32' || !onlyModules.includes('node-pty')) {\n    return\n  }\n\n  const nodePtyDir = resolve(projectDir, 'node_modules', 'node-pty')\n  if (!existsSync(join(nodePtyDir, 'build', 'Release', 'conpty.node'))) {\n    return\n  }\n  const conptyRoot = join(nodePtyDir, 'third_party', 'conpty')\n  const sourceDir = readdirSync(conptyRoot, { withFileTypes: true })\n    .filter((entry) => entry.isDirectory())\n    .map((entry) => join(conptyRoot, entry.name, `win10-${rebuildArch}`))\n    .find((candidate) => existsSync(candidate))\n  if (!sourceDir) {\n    throw new Error(`node-pty has no ConPTY runtime payload for win10-${rebuildArch}`)\n  }\n\n  const runtimeDir = join(nodePtyDir, 'build', 'Release', 'conpty')\n  mkdirSync(runtimeDir, { recursive: true })\n  for (const filename of NODE_PTY_CONPTY_RUNTIME_FILES) {\n    const sourceFile = join(sourceDir, filename)\n    if (!existsSync(sourceFile)) {\n      throw new Error(`node-pty is missing ${sourceFile}`)\n    }\n    copyFileSync(sourceFile, join(runtimeDir, filename))\n  }\n  // Why: @electron/rebuild bypasses node-pty's postinstall step that normally copies these DLLs.\n  console.log(`[rebuild] Restored node-pty ConPTY runtime files for win10-${rebuildArch}.`)\n}\n\nfunction ensureElectronPackageInstalled() {\n  if (electronPackageIsUsable()) {\n    return","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/rebuild-native-deps.mjs#L165-L201","documentation":"Thrown by the ConPTY-restore step in config/scripts/rebuild-native-deps.mjs on Windows when @electron/rebuild has rebuilt node-pty's conpty.node but no `third_party/conpty/<conptyVersion>/win10-<arch>` payload directory exists for the requested rebuildArch. @electron/rebuild bypasses node-pty's postinstall (which normally copies the ConPTY DLLs), so this script restores them — and it refuses to proceed if the source payload for that architecture is absent.","triggerScenarios":"Run rebuild-native-deps.mjs on win32 with `--arch ia32` (or arm64) when the installed node-pty only ships an x64 ConPTY payload, or after a partial npm install that left third_party/conpty empty. The readdirSync/filter/map/find at lines 178-181 returns undefined, and line 182-183 throws.","commonSituations":"Cross-arch Windows packaging (e.g. building a 32-bit or ARM64 Electron installer from an x64 dev box), a truncated npm cache that omitted the ConPTY third_party payload, or a node-pty version bump that renamed the per-arch directory layout. rebuildArch mismatch with the bundled payload is the dominant cause.","solutions":["Reinstall node-pty cleanly (`rm -rf node_modules/node-pty && npm install`) so the full third_party/conpty payload is restored for your arch.","Ensure `--arch` matches an arch node-pty actually ships a ConPTY payload for (x64 is the common case).","If cross-arch packaging, confirm the node-pty version bundles the target arch payload before rebuilding."],"exampleFix":"// before\nnode config/scripts/rebuild-native-deps.mjs --platform win32 --arch ia32\n# fails: no win10-ia32 payload in node-pty/third_party/conpty\n\n// after\nnode config/scripts/rebuild-native-deps.mjs --platform win32 --arch x64","handlingStrategy":"validation","validationCode":"import { existsSync, readdirSync } from 'node:fs'\nimport { join } from 'node:path'\n\nconst conptyRoot = join('node_modules', 'node-pty', 'third_party', 'conpty')\nconst arch = process.env.npm_config_arch || process.arch\nconst found = readdirSync(conptyRoot, { withFileTypes: true })\n  .filter((e) => e.isDirectory())\n  .map((e) => join(conptyRoot, e.name, `win10-${arch}`))\n  .some(existsSync)\nif (!found) throw new Error(`No ConPTY payload for win10-${arch}; reinstall node-pty`)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match `--arch` to an architecture node-pty ships a ConPTY payload for (commonly x64).","Reinstall node-pty cleanly so third_party/conpty is fully populated before rebuild.","For cross-arch Windows builds, confirm the target arch payload exists first."],"tags":["native","windows","node-pty","conpty","build","rebuild"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}