Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Windows crash on Node.js v22 – "Cannot resize a pty that has already exited"

Open
#827 15 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
nodejs, typescript

Research direction

Start with the WindowsPtyAgent.resize path in windowsPtyAgent.js and the resize call from windowsTerminal.js, both shown in the stack trace. Reproduce the interactive PTY workflow on Windows 11 with Node.js v22, then verify that a resize after PTY exit no longer causes an uncaught crash.

Written by the indexing model from the issue text.

Description

bug help wanted

Environment:

  • OS: Windows 11
  • Node.js version: v22.12.0
  • Package: node-pty (via @lydell/node-pty, dependency of @google/gemini-cli)

Description:
When running @google/gemini-cli on Windows 11 with Node.js v22, the process crashes with the following error:

Error: Cannot resize a pty that has already exited
at WindowsPtyAgent.resize (node_modules/@lydell/node-pty/windowsPtyAgent.js:93:19)
at WindowsTerminal. (node_modules/@lydell/node-pty/windowsTerminal.js:131:26)
at Object.run (node_modules/@lydell/node-pty/windowsTerminal.js:167:50)
...

Steps to reproduce:

  1. Install Node.js v22.12.0 on Windows 11.
  2. Install @google/gemini-cli globally (npm install -g @google/gemini-cli).
  3. Run a command that triggers an interactive PTY session (e.g. rebasing workflow).
  4. Observe crash when the PTY process exits and resize is attempted.

Expected behavior:
Resize calls after PTY exit should fail gracefully or be ignored, not crash the entire process.

Actual behavior:
Process crashes with uncaught error "Cannot resize a pty that has already exited".

Notes:

  • This issue does not occur under Node.js v20 LTS.
  • It appears to be a runtime compatibility problem between node-pty and Node.js v22 ABI/stream changes.
  • Rebuilding node-pty from source (gyp_rebuild=true) does not resolve the runtime crash.

Request:
Please add compatibility support for Node.js v22 on Windows, or handle PTY resize calls more gracefully after exit.

Dominant language
TypeScript
Stars
2k
Forks
337
Avg merge
13h 17m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/node-pty

All issues in microsoft/node-pty

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.