gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Bug: CLI crashes with "Cannot resize a pty that has already exited" error after executing a shell command on Windows

Open gyunggyung opened this issue 1 year ago • 2 comments

What happened?

When using the Gemini CLI on a Windows machine, executing a simple, non-interactive shell command (like rmdir or del) causes the entire client to crash immediately after the command completes successfully.

Steps to Reproduce:

Start the Gemini CLI in a Windows Terminal or PowerShell.

Run a simple shell command that finishes quickly, for example: !rmdir /s /q my_test_folder

The command executes correctly (the folder is deleted).

The CLI immediately crashes and exits, displaying the error below.

The crash produces the following error and stack trace:

Click to view Error and Stack Trace

Error: Cannot resize a pty that has already exited at WindowsPtyAgent.resize (C:\Users\kiwoong\AppData\Roaming\npm\node_modules@google\ge) at WindowsTerminal. (C:\Users\kiwoong\AppData\Roaming\npm\node_modules@goog) at Object.run (C:\Users\kiwoong\AppData\Roaming\npm\node_modules@google\gemini-cli\nod) at C:\Users\kiwoong\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@l2 at Array.forEach () at Socket. (C:\Users\kiwoong\AppData\Roaming\npm\node_modules@google\gemini) at Socket.emit (node:events:531:35) at addChunk (node:internal/streams/readable:561:12) at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) at Readable.push (node:internal/streams/readable:392:5)

What did you expect to happen?

After the shell command executed successfully, the Gemini CLI should have remained running and ready to accept the next user command.

Client information

Below is the output from the /about command.

Platform: Windows

  • CLI Version: 0.10.0-nightly.20251013.cfb71b9d
  • Git Commit: cfb71b9d
  • Session ID: ce1ab48b-533d-4baa-856b-ae4799a63928
  • Operating System: win32 v22.20.0
  • Sandbox Environment: no sandbox
  • Model Version: gemini-2.5-pro
  • Memory Usage: 202.6 MB

Login information

Logged in using a standard Google Account with web-based authentication.

Anything else we need to know?

This issue seems to be specific to the Windows environment.

The problem is likely related to how the pseudo-terminal (pty) is handled after a process terminates. The crash is not limited to the rmdir command; it occurs consistently with other simple shell commands that finish quickly.

gyunggyung avatar Oct 14 '25 09:10 gyunggyung

same here.

hoseinchamany avatar Oct 16 '25 16:10 hoseinchamany

It's a terrible problem. But I think it's solved by using wsl.

gyunggyung avatar Oct 16 '25 18:10 gyunggyung