Skip to content

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

@SkybuckFlying

Description

@SkybuckFlying

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bughelp wantedIssues identified as good community contribution opportunities

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions