stablyai/orca · error

Refusing to patch node-pty ${packageJson.version}; expected

Error message

Refusing to patch node-pty ${packageJson.version}; expected ${EXPECTED_NODE_PTY_VERSION}

What it means

Thrown by inspectNodePtyConsoleListAgent when the installed node-pty's package.json version is not exactly '1.1.0' (EXPECTED_NODE_PTY_VERSION). The patch is pinned by exact SHA256 hashes of the original and patched source, so applying it to any other version would silently corrupt the file; the guard refuses to proceed.

Source

Thrown at config/relay-assets/node-pty-1.1.0-console-list-agent-patch.cjs:24

const ORIGINAL_SOURCE_SHA256 = '0d010879bb6680a0253d44363183d53e631f42972594eb6dcb1fb842c8c85e52'
const PATCHED_SOURCE_SHA256 = '84df20cfe711a88d2bef35078615c58a6ce14f39348a4aef40e852b854dcd857'
const ORIGINAL_BODY = 'var consoleProcessList = getConsoleProcessList(shellPid);'
const PATCHED_BODY = `var consoleProcessList;
try {
    consoleProcessList = getConsoleProcessList(shellPid);
}
catch (_a) {
    // Why: AttachConsole can fail without a Win32 console; use node-pty's timeout fallback immediately.
    consoleProcessList = [shellPid];
}`

function inspectNodePtyConsoleListAgent(relayDir = process.cwd()) {
  const nodePtyDir = resolve(relayDir, 'node_modules', 'node-pty')
  const packageJsonPath = join(nodePtyDir, 'package.json')
  const agentPath = join(nodePtyDir, 'lib', 'conpty_console_list_agent.js')
  const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))
  if (packageJson.version !== EXPECTED_NODE_PTY_VERSION) {
    throw new Error(
      `Refusing to patch node-pty ${packageJson.version}; expected ${EXPECTED_NODE_PTY_VERSION}`
    )
  }
  const source = readFileSync(agentPath, 'utf8')
  return { agentPath, source }
}

function assertPatchedNodePtyConsoleListAgent(relayDir = process.cwd()) {
  const inspected = inspectNodePtyConsoleListAgent(relayDir)
  if (sourceSha256(inspected.source) !== PATCHED_SOURCE_SHA256) {
    throw new Error('node-pty ConPTY console-list fallback is not installed')
  }
}

function patchNodePtyConsoleListAgent(relayDir = process.cwd()) {
  const inspected = inspectNodePtyConsoleListAgent(relayDir)
  const sourceHash = sourceSha256(inspected.source)
  if (sourceHash === PATCHED_SOURCE_SHA256) {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Pin node-pty to 1.1.0 in the lockfile (pnpm add node-pty@1.1.0 or pnpm install --frozen-lockfile) and retry.
  2. If upgrading node-pty is intentional, re-derive ORIGINAL_SOURCE_SHA256 and PATCHED_SOURCE_SHA256 against the new lib/conpty_console_list_agent.js and update EXPECTED_NODE_PTY_VERSION plus both hashes in config/relay-assets/node-pty-1.1.0-console-list-agent-patch.cjs.
  3. Verify the new node-pty still ships lib/conpty_console_list_agent.js with the ORIGINAL_BODY string before re-hashing.
  4. Re-run the relay postinstall hook to confirm assertPatchedNodePtyConsoleListAgent passes.

Example fix

// before — lockfile drifted to 1.1.1
// pnpm update node-pty

// after — repin
// pnpm add node-pty@1.1.0
// node config/relay-assets/node-pty-1.1.0-console-list-agent-patch.cjs
Defensive patterns

Strategy: validation

Validate before calling

const { readFileSync } = require('node:fs')
const { join } = require('node:path')

function assertNodePtyVersion(relayDir, expected = '1.1.0') {
  const pkg = JSON.parse(readFileSync(join(relayDir, 'node_modules', 'node-pty', 'package.json'), 'utf8'))
  if (pkg.version !== expected) {
    throw new Error(`node-pty is ${pkg.version}, expected ${expected}. Run 'pnpm add node-pty@${expected}'.`)
  }
}
// assertNodePtyVersion(process.cwd()) before invoking the patch

Try / catch

try {
  inspectNodePtyConsoleListAgent(relayDir)
} catch (error) {
  if (/Refusing to patch node-pty/.test(error.message)) {
    console.error(`${error.message}\nPin node-pty@1.1.0 in the lockfile, or re-derive the patch hashes for the new version.`)
    process.exit(1)
  }
  throw error
}

Prevention

When it happens

Trigger: Calling patchNodePtyConsoleListAgent or assertPatchedNodePtyConsoleListAgent after node-pty was upgraded or downgraded away from 1.1.0; a lockfile resolve bumped node-pty to a patch release (e.g. 1.1.1).

Common situations: Dependency refresh (pnpm update node-pty) pulled a newer release; a transitive dependency forced a different node-pty; the relay install ran against a fresh node_modules where node-pty resolved higher than the lockfile intended.

Related errors


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