CLI Crashes on Windows with "Cannot resize a pty that has already exited"
What happened?
The Gemini CLI crashes on Windows when attempting to execute a chmod +x command.
Steps to Reproduce:
- Launch the Gemini CLI on a Windows machine.
- Ask the agent to execute a chmod +x command on any file. For example: chmod +x C:\Users\Kris\stremio-nvenc\stremio-docker-nvidia\entrypoint.sh
- The CLI crashes instantly.
What did you expect to happen?
The CLI should not crash. It should handle the error gracefully by reporting that chmod is not a recognized command on Windows.
Client information
- CLI Version: 0.6.1
- Git Commit: f3078136
- Session ID: 44e0bd13-5b49-4cce-857f-3527082e3302
- Operating System: win32 v22.20.0
- Sandbox Environment: no sandbox
- Model Version: gemini-2.5-pro
- Memory Usage: 205.4 MB
Login information
Google Account OAUTH
Anything else we need to know?
This crash occurs because chmod is not a native Windows cmd.exe command. The shell process inside the pseudo-terminal exits immediately upon receiving the invalid command, but the CLI tool subsequently attempts to interact with the now-defunct terminal, leading to a fatal error.
Full Error Log: ` C:\Users\Kris\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsPtyAgent.js:93 throw new Error('Cannot resize a pty that has already exited'); ^
Error: Cannot resize a pty that has already exited
at WindowsPtyAgent.resize
(C:\Users\Kris\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsPtyAgent.js:93:19)
at WindowsTerminal.
Node.js v22.20.0 `
hi @iceman3k ; could you please tell me which terminal were you using to execute the command. I tried on powershell and also on command prompt, but gemini cli not crash, I have used the same version as yours, you can see the commit bash being the same. Attaching screenshot for reference:
Command Prompt:
Power Shell:
Hi @iceman3k , please let me know if you are still able to see the issue, otherwise I will close this issue.
@gsehgal I am using Windows Terminal, Powershell 7.5.3
hi @iceman3k , could you please try installing the latest version:
npm install -g @google/gemini-cli@latest
I ran it on the following, and it did not crash: Windows 11 Enterprise , powershell version 7.5.3 Windows 11 Pro , powershell version 5.1
also the command I gave gemini was:
run chmod +x C:\Users\gsehgal\test.sh
please let me know if there is any other command which can reproduce this error. Thanks
Versions past 0.6.1 do not seem to have this issue. I would like to "complain" about all the API errors, but that is a separate issue. thanks @gsehgal .
Hi @iceman3k , please feel free to raise issues regarding the API errors. Will be closing this issue.
Thanks
same happening here.
`│ ✓ Shell mkdir public src storage (Create new directories for project restructure.) │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ✦ I will now move the public-facing files and assets into the public directory. I'll start with index.php. ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ ⊶ Shell move index.php public\index.php (Move index.php to the public directory.) │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ⠋ Implementing Asset Movement (esc to cancel, 0s)
Using: 2 GEMINI.md files | 1 MCP server (ctrl+t to view) ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ > │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ~\PhpstormProjects\bandwidthd no sandbox (see gemini-2.5-pro (99% context | ✖ 1 error (ctrl+o for (master*) /docs) left) details) C:\Users\NullUser\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsPtyAgent.js:93 throw new Error('Cannot resize a pty that has already exited'); ^
Error: Cannot resize a pty that has already exited
at WindowsPtyAgent.resize (C:\Users\NullUser\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsPtyAgent.js:93:19)
at WindowsTerminal.
Node.js v20.10.0 `
@gsehgal This is definitely an issue. Experienced this today with a fresh install of node, and the cli @ latest after dropping to shell mode and issuing the command dir. This occurred previously after jumping to shell mode and issuing mkdir. Screenshot of the latest instance:
Request that this bug be reopened and investigated further.
Tried upgrading to power shell 7.5.3, same result. This is a windows 11 pro box:
Hi @xilsanctified sure let me re-open this and test this further.
Hi, I have just started having a similar issue with the latest version of gemini-cli on windows. I allowed gemini-cli to auto-update an hour ago
Previously, I was able to get gemini-cli to commit the changes to the project to the remote repo, now it crashes out.
I can replicate the problem simply by opening gemini and running
!git status
C:\Users\mr_yo\AppData\Roaming\npm\node_modules\@google\gemini-cli\node_modules\@lydell\node-pty\windowsPtyAgent.js:93
throw new Error('Cannot resize a pty that has already exited');
^
Error: Cannot resize a pty that has already exited
at WindowsPtyAgent.resize (C:\Users\mr_yo\AppData\Roaming\npm\node_modules\@google\gemini-cli\node_modules\@lydell\node-pty\windowsPtyAgent.js:93:19)
at WindowsTerminal.<anonymous> (C:\Users\mr_yo\AppData\Roaming\npm\node_modules\@google\gemini-cli\node_modules\@lydell\node-pty\windowsTerminal.js:131:26)
at Object.run (C:\Users\mr_yo\AppData\Roaming\npm\node_modules\@google\gemini-cli\node_modules\@lydell\node-pty\windowsTerminal.js:167:50)
at C:\Users\mr_yo\AppData\Roaming\npm\node_modules\@google\gemini-cli\node_modules\@lydell\node-pty\windowsTerminal.js:73:32
at Array.forEach (<anonymous>)
at Socket.<anonymous> (C:\Users\mr_yo\AppData\Roaming\npm\node_modules\@google\gemini-cli\node_modules\@lydell\node-pty\windowsTerminal.js:68:42)
at Socket.emit (node:events:530: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)
Node.js v22.17.0
C:\Users\norberto.lodela\AppData\Roaming\nvm\v23.11.1\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsPtyAgent.js:93 throw new Error('Cannot resize a pty that has already exited'); ^
Error: Cannot resize a pty that has already exited
at WindowsPtyAgent.resize (C:\Users\norberto.lodela\AppData\Roaming\nvm\v23.11.1\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsPtyAgent.js:93:19)
at WindowsTerminal.
Node.js v23.11.1
Hi, I don't believe this has been fully resolved. this morning: updated node (v22.21.0) updated npm (11.5.2) updated gemini ran gemini !git status - this worked fine (a step forward) typed in quit, and the same error happened
`C:\Users\mr_yo\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsPtyAgent.js:93 throw new Error('Cannot resize a pty that has already exited'); ^
Error: Cannot resize a pty that has already exited
at WindowsPtyAgent.resize (C:\Users\mr_yo\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsPtyAgent.)
at WindowsTerminal.
Node.js v22.21.0`
Do I raise a new issue?
When are you guys gona fix this.... is toooooo anoying when you are working on something and with no reason gemini simply stops and this message appears:
C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modules@google\gemini-cli\node_modules@3 throw new Error('Cannot resize a pty that has already exited'); ^
Error: Cannot resize a pty that has already exited
at WindowsPtyAgent.resize (C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modules@g)
at WindowsTerminal.
Node.js v24.10.0
Is there an error on node? is there any version that stabilizes Gemini cli? I have tryed versions: 18, 20, 22, 23 and 24... and nothing... is there any solution so far???
...~\icons_converter no sandbox gemini-2.5-pro (99%) | ✖ 8 errors (ctrl+o for details) C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modules@google\gemini-cli\node_modules@l3 throw new Error('Cannot resize a pty that has already exited'); ^
Error: Cannot resize a pty that has already exited
at WindowsPtyAgent.resize (C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modules@go)
at WindowsTerminal.
Node.js v24.10.0
Unfortunately we're getting a bunch of reports that this issue is persisting despite https://github.com/google-gemini/gemini-cli/pull/12587 being merged. I will reopen this and dedup a bunch of issue to this.
Attention @galz10
#13353