{"record":{"id":"d3766664918511f6","repo":"stablyai/orca","slug":"node-pty-conpty-console-list-fallback-is-not-insta","errorCode":null,"errorMessage":"node-pty ConPTY console-list fallback is not installed","messagePattern":"node-pty ConPTY console-list fallback is not installed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/relay-assets/node-pty-1.1.0-console-list-agent-patch.cjs","lineNumber":35,"sourceCode":"\nfunction inspectNodePtyConsoleListAgent(relayDir = process.cwd()) {\n  const nodePtyDir = resolve(relayDir, 'node_modules', 'node-pty')\n  const packageJsonPath = join(nodePtyDir, 'package.json')\n  const agentPath = join(nodePtyDir, 'lib', 'conpty_console_list_agent.js')\n  const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))\n  if (packageJson.version !== EXPECTED_NODE_PTY_VERSION) {\n    throw new Error(\n      `Refusing to patch node-pty ${packageJson.version}; expected ${EXPECTED_NODE_PTY_VERSION}`\n    )\n  }\n  const source = readFileSync(agentPath, 'utf8')\n  return { agentPath, source }\n}\n\nfunction assertPatchedNodePtyConsoleListAgent(relayDir = process.cwd()) {\n  const inspected = inspectNodePtyConsoleListAgent(relayDir)\n  if (sourceSha256(inspected.source) !== PATCHED_SOURCE_SHA256) {\n    throw new Error('node-pty ConPTY console-list fallback is not installed')\n  }\n}\n\nfunction patchNodePtyConsoleListAgent(relayDir = process.cwd()) {\n  const inspected = inspectNodePtyConsoleListAgent(relayDir)\n  const sourceHash = sourceSha256(inspected.source)\n  if (sourceHash === PATCHED_SOURCE_SHA256) {\n    return\n  }\n  if (sourceHash !== ORIGINAL_SOURCE_SHA256) {\n    throw new Error('Refusing to patch unexpected node-pty console-list agent source')\n  }\n  const patchedSource = inspected.source.replace(ORIGINAL_BODY, PATCHED_BODY)\n  const temporaryPath = `${inspected.agentPath}.orca-patch-${process.pid}`\n  // Why: a terminated remote install must leave either known source version recoverable on reconnect.\n  try {\n    writeFileSync(temporaryPath, patchedSource)\n    renameSync(temporaryPath, inspected.agentPath)","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/relay-assets/node-pty-1.1.0-console-list-agent-patch.cjs#L17-L53","documentation":"Thrown by assertPatchedNodePtyConsoleListAgent when the SHA256 of lib/conpty_console_list_agent.js does not equal PATCHED_SOURCE_SHA256. The assertion is the verification step at the end of patchNodePtyConsoleListAgent and is also called standalone during relay startup to confirm the ConPTY console-list fallback (the try/catch around getConsoleProcessList) is actually installed.","triggerScenarios":"Relay startup on Windows where node-pty's install ran but the postinstall patch step never executed; the file was restored to its original form by a reinstall but the patch step was skipped; a different patch or upstream change produced a third hash.","commonSituations":"Relay postinstall hook disabled or skipped in CI; node_modules restored from a cache that predates the patch; running the relay binary on a host where the patch had not been baked in at build time.","solutions":["Run node config/relay-assets/node-pty-1.1.0-console-list-agent-patch.cjs from the relay directory to apply the patch.","Ensure the relay's postinstall hook invokes patchNodePtyConsoleListAgent and that it is not skipped under --ignore-scripts.","Confirm node-pty is still 1.1.0 (otherwise you will hit error 23 first).","If the patch step reports success but this still fires, re-derive PATCHED_SOURCE_SHA256 against the patched file and update the constant."],"exampleFix":"// before — relay started without the patch\n// node dist/relay.js   // -> 'node-pty ConPTY console-list fallback is not installed'\n\n// after — apply the patch then start\n// node config/relay-assets/node-pty-1.1.0-console-list-agent-patch.cjs\n// node dist/relay.js","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  assertPatchedNodePtyConsoleListAgent(relayDir)\n} catch (error) {\n  if (/console-list fallback is not installed/.test(error.message)) {\n    // Apply the patch rather than starting the relay unpatched.\n    patchNodePtyConsoleListAgent(relayDir)\n    assertPatchedNodePtyConsoleListAgent(relayDir)\n    return\n  }\n  throw error\n}","preventionTips":["Make the relay startup wrapper call patchNodePtyConsoleListAgent() unconditionally (it is idempotent — returns early if already patched).","Ensure the postinstall hook runs without --ignore-scripts in every environment that ships the relay.","Add a startup self-check that asserts the patched state and exits with a clear remediation message if not."],"tags":["node-pty","relay","patch","conpty","postinstall"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}