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

CLI Crashes on Windows with "Cannot resize a pty that has already exited"

Open iceman3k opened this issue 1 year ago • 27 comments

What happened?

The Gemini CLI crashes on Windows when attempting to execute a chmod +x command.

Steps to Reproduce:

  1. Launch the Gemini CLI on a Windows machine.
  2. 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
  3. 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. (C:\Users\Kris\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell \node-pty\windowsTerminal.js:131:26) at Object.run (C:\Users\Kris\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windows Terminal.js:167:50) at C:\Users\Kris\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:73:32 at Array.forEach () at Socket. (C:\Users\Kris\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:68:42) 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)

Node.js v22.20.0 `

iceman3k avatar Sep 30 '25 18:09 iceman3k

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:

Image

Power Shell:

Image

gsehgal avatar Oct 11 '25 04:10 gsehgal

Hi @iceman3k , please let me know if you are still able to see the issue, otherwise I will close this issue.

gsehgal avatar Oct 13 '25 04:10 gsehgal

@gsehgal I am using Windows Terminal, Powershell 7.5.3

iceman3k avatar Oct 14 '25 18:10 iceman3k

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

gsehgal avatar Oct 15 '25 14:10 gsehgal

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

gsehgal avatar Oct 15 '25 15:10 gsehgal

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 .

iceman3k avatar Oct 15 '25 17:10 iceman3k

Hi @iceman3k , please feel free to raise issues regarding the API errors. Will be closing this issue.

Thanks

gsehgal avatar Oct 15 '25 23:10 gsehgal

same happening here.

hoseinchamany avatar Oct 16 '25 16:10 hoseinchamany

`│ ✓ 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. (C:\Users\NullUser\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:131:26) at Object.run (C:\Users\NullUser\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:167:50) at C:\Users\NullUser\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:73:32 at Array.forEach () at Socket. (C:\Users\NullUser\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:68:42) at Socket.emit (node:events:526:35) at addChunk (node:internal/streams/readable:545:12) at readableAddChunkPushByteMode (node:internal/streams/readable:495:3) at Readable.push (node:internal/streams/readable:375:5)

Node.js v20.10.0 `

hoseinchamany avatar Oct 16 '25 16:10 hoseinchamany

@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:

Image Image

Request that this bug be reopened and investigated further.

xilsanctified avatar Oct 16 '25 21:10 xilsanctified

Tried upgrading to power shell 7.5.3, same result. This is a windows 11 pro box:

Image

xilsanctified avatar Oct 16 '25 21:10 xilsanctified

Hi @xilsanctified sure let me re-open this and test this further.

gsehgal avatar Oct 17 '25 05:10 gsehgal

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

Flank1e avatar Oct 17 '25 14:10 Flank1e

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. (C:\Users\norberto.lodela\AppData\Roaming\nvm\v23.11.1\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:131:26) at Object.run (C:\Users\norberto.lodela\AppData\Roaming\nvm\v23.11.1\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:167:50) at C:\Users\norberto.lodela\AppData\Roaming\nvm\v23.11.1\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:73:32 at Array.forEach () at Socket. (C:\Users\norberto.lodela\AppData\Roaming\nvm\v23.11.1\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:68:42) at Socket.emit (node:events:519:35) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Readable.push (node:internal/streams/readable:390:5)

Node.js v23.11.1

lodela avatar Oct 17 '25 16:10 lodela

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. (C:\Users\mr_yo\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerm) 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 () at Socket. (C:\Users\mr_yo\AppData\Roaming\npm\node_modules@google\gemini-cli\node_modules@lydell\node-pty\windowsTerminal.js:6) 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)

Node.js v22.21.0`

Image

Do I raise a new issue?

Flank1e avatar Oct 23 '25 10:10 Flank1e

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. (C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modul) at Object.run (C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modules@google\gemini) at C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modules@google\gemini-cli\node_mo2 at Array.forEach () at Socket. (C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modules@googl) at Socket.emit (node:events:520:35) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Readable.push (node:internal/streams/readable:390:5)

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???

lodela avatar Oct 28 '25 20:10 lodela

...~\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. (C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_module) at Object.run (C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modules@google\gemini-) at C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modules@google\gemini-cli\node_mod2 at Array.forEach () at Socket. (C:\Users\norberto.lodela\AppData\Roaming\nvm\v24.10.0\node_modules@google) at Socket.emit (node:events:520:35) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Readable.push (node:internal/streams/readable:390:5)

Node.js v24.10.0

lodela avatar Oct 30 '25 15:10 lodela

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.

scidomino avatar Nov 19 '25 19:11 scidomino

Attention @galz10

scidomino avatar Nov 19 '25 19:11 scidomino

#13353

galdawave avatar Nov 19 '25 19:11 galdawave