Windows crash on Node.js v22 – "Cannot resize a pty that has already exited"
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
- Domain
- operating-systems
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
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:
- Install Node.js v22.12.0 on Windows 11.
- Install @google/gemini-cli globally (
npm install -g @google/gemini-cli). - Run a command that triggers an interactive PTY session (e.g. rebasing workflow).
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/node-pty
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
microsoft/node-pty#951 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
All issues in microsoft/node-pty
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
external-issue to-triage
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
diegosouzapw/OmniRoute#15401 ·
Maintainers usually reply within 2 days
-
Sign the pledgeOpen
Difficulty 1/5 Under an hour Newbie friendliness 95/100
input-output-hk/devx-updates#163 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
code-yeongyu/oh-my-openagent#9454 ·
Maintainers usually reply within 1 day