{"record":{"id":"8b50d450f0546e0e","repo":"stablyai/orca","slug":"packaged-node-pty-is-missing-conptyroot","errorCode":null,"errorMessage":"Packaged node-pty is missing ${conptyRoot}","messagePattern":"Packaged node-pty is missing (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"config/packaged-runtime-node-modules.cjs","lineNumber":300,"sourceCode":"  const targetPrefix = `${platformPrefix}${architecture}`\n  const platformPrefixes = Object.values(NODE_PTY_PREBUILD_PREFIX_BY_PLATFORM)\n  for (const entry of readdirSync(directory, { withFileTypes: true })) {\n    if (!entry.isDirectory() || !platformPrefixes.some((prefix) => entry.name.startsWith(prefix))) {\n      continue\n    }\n    const matchesTarget =\n      entry.name.startsWith(platformPrefix) &&\n      (entry.name === targetPrefix || (allowsSuffix && entry.name.startsWith(`${targetPrefix}-`)))\n    if (!matchesTarget) {\n      rmSync(join(directory, entry.name), { recursive: true, force: true })\n    }\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  }","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/packaged-runtime-node-modules.cjs#L282-L318","documentation":"Thrown by findNodePtyConptySourceDir when packaging node-pty for a Windows build: the directory node_modules/node-pty/third_party/conpty does not exist. The packager needs that vendor tree to source conpty.dll and OpenConsole.exe at runtime, because node-pty's Windows addon loads conpty.dll relative to conpty.node and its install script can run before electron-builder gathers resources. Only reached when build/Release/conpty.node exists and at least one runtime file (conpty.dll or OpenConsole.exe) is missing from build/Release/conpty.","triggerScenarios":"Called during prunePackagedNodePty (electronPlatformName === 'win32') when ensurePackagedNodePtyConptyRuntime finds missing NODE_PTY_CONPTY_RUNTIME_FILES. The third_party/conpty directory was either never installed, pruned by an earlier step, or removed by an npm/pnpm reinstall that stripped optional vendor assets.","commonSituations":"Reinstalling node-pty with --omit=optional or a pnpm hoist setting that drops third_party; running a Windows packager step on a stale node_modules; CI caching that excluded the conpty vendor tree; upgrading node-pty to a version that renamed or removed the third_party layout.","solutions":["Run pnpm rebuild node-pty (or npm rebuild node-pty) so the install script restores third_party/conpty.","Verify the install was not run with flags that skip optional dependencies (remove --omit=optional / --prod from the install line for the packaging step).","Confirm node-pty is still version 1.1.0 (the version this packager is wired for) via node_modules/node-pty/package.json.","If node-pty upstream changed its vendor layout, update findNodePtyConptySourceDir in config/packaged-runtime-node-modules.cjs to match the new path."],"exampleFix":"// before (install skipped optional vendor assets)\n// pnpm install --prod\n\n// after\n// pnpm install\n// pnpm rebuild node-pty\n// then confirm the dir exists:\n//   ls node_modules/node-pty/third_party/conpty/*/win10-x64","handlingStrategy":"validation","validationCode":"const { existsSync } = require('node:fs')\nconst { join } = require('node:path')\n\nfunction assertNodePtyConptyVendorPresent(nodePtyDir) {\n  const conptyRoot = join(nodePtyDir, 'third_party', 'conpty')\n  if (!existsSync(conptyRoot)) {\n    throw new Error(`Refusing to package: ${conptyRoot} missing. Run 'pnpm rebuild node-pty' first.`)\n  }\n}\n// call before prunePackagedNodePty:\n// assertNodePtyConptyVendorPresent(join(resourcesDir, 'node_modules', 'node-pty'))","typeGuard":null,"tryCatchPattern":"try {\n  ensurePackagedNodePtyConptyRuntime(nodePtyDir, electronArch)\n} catch (error) {\n  if (/Packaged node-pty is missing/.test(error.message)) {\n    console.error(`${error.message}\\nRun 'pnpm rebuild node-pty' then retry the package step.`)\n    process.exit(1)\n  }\n  throw error\n}","preventionTips":["Run 'pnpm rebuild node-pty' as an explicit step before electron-builder in CI, not only via postinstall.","Cache node_modules with third_party/ included — never strip optional vendor directories.","Pin node-pty to 1.1.0 in the lockfile so the vendor layout matches what the packager expects.","Fail the build fast with a presence check on third_party/conpty before invoking the packager."],"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"}