{"record":{"id":"c6176e914d9ddda4","repo":"stablyai/orca","slug":"node-pty-conpty-runtime-file-is-missing-runtime","errorCode":null,"errorMessage":"node-pty ConPTY runtime file is missing: ${runtimeFile}","messagePattern":"node-pty ConPTY runtime file is missing: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/rebuild-native-deps.mjs","lineNumber":506,"sourceCode":"  projectRequire(moduleName)\n}\n\nfunction assertNodePtyWindowsConptyRuntime(nativeDir) {\n  if (process.platform !== 'win32' || !isNodePtyReleaseBuildDir(nativeDir)) {\n    return\n  }\n  const runtimeDir = resolve(\n    process.cwd(),\n    'node_modules',\n    'node-pty',\n    'build',\n    'Release',\n    'conpty'\n  )\n  for (const filename of ${JSON.stringify(NODE_PTY_CONPTY_RUNTIME_FILES)}) {\n    const runtimeFile = resolve(runtimeDir, filename)\n    if (!existsSync(runtimeFile)) {\n      throw new Error('node-pty ConPTY runtime file is missing: ' + runtimeFile)\n    }\n  }\n}\n\nfunction isNodePtyReleaseBuildDir(nativeDir) {\n  return typeof nativeDir === 'string' && nativeDir.replace(/\\\\\\\\/g, '/').includes('build/Release/')\n}\n\nfunction getNodePtyNativeModuleName() {\n  if (process.platform !== 'win32') {\n    return 'pty'\n  }\n  const match = /(\\\\d+)\\\\.(\\\\d+)\\\\.(\\\\d+)/g.exec(release())\n  const buildNumber = match && match.length === 4 ? Number.parseInt(match[3], 10) : 0\n  return buildNumber >= 18309 ? 'conpty' : 'pty'\n}\n\nfunction formatError(error) {","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/rebuild-native-deps.mjs#L488-L524","documentation":"Thrown by assertNodePtyWindowsConptyRuntime inside the Electron native-module probe (probeElectronNativeModules) on win32 when node-pty's build/Release/conpty directory is missing one of the expected ConPTY runtime files. This is the probe-time counterpart to the restore step (errors 169/170): it verifies that the DLLs the restore step copies are actually present at load time. If the restore was skipped or its files were removed, loading node-pty under Electron on Windows will fail at first ConPTY use.","triggerScenarios":"On win32, after a rebuild where the ConPTY DLL-restore step did not run (e.g. node-pty was rebuilt via @electron/rebuild but the post-restore in errors 169/170's function was bypassed) or where build/Release/conpty was later deleted. The loop over NODE_PTY_CONPTY_RUNTIME_FILES at lines 502-506 throws on the first missing file.","commonSituations":"The restore step returned early (conpty.node did not exist at restore time), a clean/strip step removed build/Release/conpty after the restore, or a partial install left only some DLLs. This fires when node-pty is probed under Electron on Windows without the runtime DLLs in place.","solutions":["Rerun rebuild-native-deps.mjs so the ConPTY restore step (errors 169/170's function) copies the DLLs into build/Release/conpty.","Confirm node-pty's build/Release/conpty.node exists before the restore runs (the restore returns early otherwise).","Reinstall node-pty to repopulate the third_party/conpty source payload, then rerun the rebuild."],"exampleFix":"// before\n# build/Release/conpty exists but is missing a DLL\nnode config/scripts/rebuild-native-deps.mjs --platform win32\n# -> node-pty ConPTY runtime file is missing: ...\n\n// after\nrm -rf node_modules/node-pty && npm install\nnode config/scripts/rebuild-native-deps.mjs --platform win32","handlingStrategy":"validation","validationCode":"import { existsSync, readdirSync } from 'node:fs'\nimport { join } from 'node:path'\n\nif (process.platform === 'win32') {\n  const runtimeDir = join('node_modules', 'node-pty', 'build', 'Release', 'conpty')\n  const files = existsSync(runtimeDir) ? readdirSync(runtimeDir) : []\n  if (files.length === 0) {\n    throw new Error('ConPTY runtime dir empty; rerun rebuild-native-deps.mjs --platform win32')\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Rerun rebuild-native-deps.mjs on Windows so the ConPTY restore step copies the DLLs.","Ensure build/Release/conpty.node exists before the restore (the restore returns early otherwise).","Do not strip build/Release/conpty after rebuild; the probe validates its presence."],"tags":["native","windows","node-pty","conpty","build","electron"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}