stablyai/orca · critical

Packaged node-pty is missing ${sourceFile}

Error message

Packaged node-pty is missing ${sourceFile}

What it means

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.

Source

Thrown at config/packaged-runtime-node-modules.cjs:334

  if (!existsSync(join(releaseDir, 'conpty.node'))) {
    return
  }

  const runtimeDir = join(releaseDir, 'conpty')
  const missingRuntimeFiles = NODE_PTY_CONPTY_RUNTIME_FILES.filter(
    (filename) => !existsSync(join(runtimeDir, filename))
  )
  if (missingRuntimeFiles.length === 0) {
    return
  }

  const windowsArch = normalizeNodePtyWindowsArch(electronArch)
  const sourceDir = findNodePtyConptySourceDir(nodePtyDir, windowsArch)
  mkdirSync(runtimeDir, { recursive: true })
  for (const filename of missingRuntimeFiles) {
    const sourceFile = join(sourceDir, filename)
    if (!existsSync(sourceFile)) {
      throw new Error(`Packaged node-pty is missing ${sourceFile}`)
    }
    // Why: node-pty's Windows addon loads conpty.dll relative to conpty.node,
    // but its install script can run before electron-builder gathers resources.
    copyFileSync(sourceFile, join(runtimeDir, filename))
  }
}

function prunePackagedNodePty(resourcesDir, electronPlatformName, electronArch) {
  const nodePtyDir = join(resourcesDir, 'node_modules', 'node-pty')
  if (!existsSync(nodePtyDir)) {
    return
  }

  const allowedPrebuildPrefix = NODE_PTY_PREBUILD_PREFIX_BY_PLATFORM[electronPlatformName]
  if (allowedPrebuildPrefix) {
    pruneNodePtyNativeDirectories(
      join(nodePtyDir, 'prebuilds'),
      allowedPrebuildPrefix,

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Delete node_modules/node-pty and reinstall so the prebuild is re-extracted cleanly.
  2. Inspect node_modules/node-pty/third_party/conpty/<vendor>/win10-<arch>/ and confirm both conpty.dll and OpenConsole.exe are present.
  3. 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).
  4. On a Windows build host, check antivirus/Defender quarantine history for OpenConsole.exe and add an exclusion.

Example fix

// before — partial vendor dir
// ls node_modules/node-pty/third_party/conpty/*/win10-x64
//   conpty.dll            (OpenConsole.exe missing)

// after — clean reinstall restores both files
// rm -rf node_modules/node-pty && pnpm install
// ls node_modules/node-pty/third_party/conpty/*/win10-x64
//   conpty.dll  OpenConsole.exe
Defensive patterns

Strategy: validation

Validate before calling

const { existsSync, readdirSync } = require('node:fs')
const { join } = require('node:path')
const REQUIRED = ['conpty.dll', 'OpenConsole.exe']

function assertConptyRuntimeFilesPresent(sourceDir) {
  const missing = REQUIRED.filter((f) => !existsSync(join(sourceDir, f)))
  if (missing.length) {
    throw new Error(`ConPTY source dir ${sourceDir} missing ${missing.join(', ')}; reinstall node-pty.`)
  }
}
// call after findNodePtyConptySourceDir returns:
// assertConptyRuntimeFilesPresent(sourceDir)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/ac8cd9a012a64630. Report an issue: GitHub.