{"record":{"id":"ac8cd9a012a64630","repo":"stablyai/orca","slug":"packaged-node-pty-is-missing-sourcefile","errorCode":null,"errorMessage":"Packaged node-pty is missing ${sourceFile}","messagePattern":"Packaged node-pty is missing (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"config/packaged-runtime-node-modules.cjs","lineNumber":334,"sourceCode":"  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)\n  mkdirSync(runtimeDir, { recursive: true })\n  for (const filename of missingRuntimeFiles) {\n    const sourceFile = join(sourceDir, filename)\n    if (!existsSync(sourceFile)) {\n      throw new Error(`Packaged node-pty is missing ${sourceFile}`)\n    }\n    // Why: node-pty's Windows addon loads conpty.dll relative to conpty.node,\n    // but its install script can run before electron-builder gathers resources.\n    copyFileSync(sourceFile, join(runtimeDir, filename))\n  }\n}\n\nfunction prunePackagedNodePty(resourcesDir, electronPlatformName, electronArch) {\n  const nodePtyDir = join(resourcesDir, 'node_modules', 'node-pty')\n  if (!existsSync(nodePtyDir)) {\n    return\n  }\n\n  const allowedPrebuildPrefix = NODE_PTY_PREBUILD_PREFIX_BY_PLATFORM[electronPlatformName]\n  if (allowedPrebuildPrefix) {\n    pruneNodePtyNativeDirectories(\n      join(nodePtyDir, 'prebuilds'),\n      allowedPrebuildPrefix,","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/packaged-runtime-node-modules.cjs#L316-L352","documentation":"Thrown by ensurePackagedNodePtyConptyRuntime while copying the ConPTY runtime files (conpty.dll, OpenConsole.exe) into build/Release/conpty. The matching win10-<arch> source directory was found, but one of the expected filenames in NODE_PTY_CONPTY_RUNTIME_FILES is absent there. This is a finer-grained variant of errors 20/21: the vendor directory exists and matches the arch, but is itself incomplete.","triggerScenarios":"The prebuild vendor directory exists for the target arch but is missing OpenConsole.exe (or conpty.dll) due to a partial extraction, a corrupt download, or an upstream node-pty packaging change that renamed a file.","commonSituations":"Interrupted/corrupted prebuild download; CI cache of node_modules populated from a broken tarball; node-pty upstream renamed or stopped bundling OpenConsole.exe in a patch release; antivirus quarantine of OpenConsole.exe on a Windows build host.","solutions":["Delete node_modules/node-pty and reinstall so the prebuild is re-extracted cleanly.","Inspect node_modules/node-pty/third_party/conpty/<vendor>/win10-<arch>/ and confirm both conpty.dll and OpenConsole.exe are present.","If upstream renamed a file, update NODE_PTY_CONPTY_RUNTIME_FILES in config/packaged-runtime-node-modules.cjs (and the mirrors in rebuild-native-deps.mjs / ensure-native-runtime.mjs).","On a Windows build host, check antivirus/Defender quarantine history for OpenConsole.exe and add an exclusion."],"exampleFix":"// before — partial vendor dir\n// ls node_modules/node-pty/third_party/conpty/*/win10-x64\n//   conpty.dll            (OpenConsole.exe missing)\n\n// after — clean reinstall restores both files\n// rm -rf node_modules/node-pty && pnpm install\n// ls node_modules/node-pty/third_party/conpty/*/win10-x64\n//   conpty.dll  OpenConsole.exe","handlingStrategy":"validation","validationCode":"const { existsSync, readdirSync } = require('node:fs')\nconst { join } = require('node:path')\nconst REQUIRED = ['conpty.dll', 'OpenConsole.exe']\n\nfunction assertConptyRuntimeFilesPresent(sourceDir) {\n  const missing = REQUIRED.filter((f) => !existsSync(join(sourceDir, f)))\n  if (missing.length) {\n    throw new Error(`ConPTY source dir ${sourceDir} missing ${missing.join(', ')}; reinstall node-pty.`)\n  }\n}\n// call after findNodePtyConptySourceDir returns:\n// assertConptyRuntimeFilesPresent(sourceDir)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After installing node-pty, run a smoke check that both conpty.dll and OpenConsole.exe exist in the vendor dir for the target arch.","Do not trust partially-populated CI caches of node_modules — checksum the vendor dir.","On Windows build hosts, add an antivirus exclusion for OpenConsole.exe to prevent silent quarantine."],"tags":["node-pty","packaging","windows","filesystem","conpty"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}