gemini-cli - 💡(How to fix) Fix Terminal Resize Issue

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

When running gemini --resume and then resizing the terminal the following error appears : ERROR ioctl(2) failed, EBADF 241: throw new Error('resizing must be done using positive cols and rows'); An unexpected critical error occurred:Error: ioctl(2) failed, EBADF My guess as to why this is happening is this exception is not being thrown and we somehow get negative rows or columns when resizing the terminal: throw new Error('resizing must be done using positive cols and rows'); 243: pty.resize(this._fd, cols, rows); <this line is where the error show

RAW_BUFFERClick to expand / collapse

What happened?

When running gemini --resume and then resizing the terminal the following error appears :

ERROR ioctl(2) failed, EBADF

/usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/node_modules/@lydell/node-pty/unixTerminal.js:243:13

240: if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) { 241: throw new Error('resizing must be done using positive cols and rows'); 242: } 243: pty.resize(this._fd, cols, rows); 244: this._cols = cols; 245: this._rows = rows; 246: };

  • UnixTerminal.resize (/usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/node_modules/@lydell/node-pty/unixTerminal.js:243:13)
  • _ShellExecutionService.resizePty (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-BE42OOYM.js:320262:30)
  • (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/interactiveCli-RDMZS6KL.js:6529:31)
  • commitHookEffectListMount (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:5260:30)
  • commitPassiveMountOnFiber (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6282:29)
  • recursivelyTraversePassiveMountEffects (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6263:13)
  • commitPassiveMountOnFiber (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6374:13)
  • recursivelyTraversePassiveMountEffects (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6263:13)
  • commitPassiveMountOnFiber (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6374:13)
  • recursivelyTraversePassiveMountEffects (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6263:13)

An unexpected critical error occurred:Error: ioctl(2) failed, EBADF at UnixTerminal.resize (/usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/node_modules/@lydell/node-pty/unixTerminal.js:243:13) at _ShellExecutionService.resizePty (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-BE42OOYM.js:320262:30) at file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/interactiveCli-RDMZS6KL.js:6529:31 at commitHookEffectListMount (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:5260:30) at commitPassiveMountOnFiber (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6282:29) at recursivelyTraversePassiveMountEffects (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6263:13) at commitPassiveMountOnFiber (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6374:13) at recursivelyTraversePassiveMountEffects (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6263:13) at commitPassiveMountOnFiber (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6374:13) at recursivelyTraversePassiveMountEffects (file:///usr/local/nvm/versions/node/v24.16.0/lib/node_modules/@google/gemini-cli/bundle/chunk-VUERI7WB.js:6263:13)

What did you expect to happen?

My guess as to why this is happening is this exception is not being thrown and we somehow get negative rows or columns when resizing the terminal:

if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) { throw new Error('resizing must be done using positive cols and rows'); }

243: pty.resize(this._fd, cols, rows); <this line is where the error show

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
About Gemini CLI                                                                                                                                                             │ 
│                                                                                                                                                                              │ 
│ CLI Version                                                 0.44.0                                                                                                           │ 
│ Git Commit                                                  1000b33d4                                                                                                        │ 
│ Model                                                       gemini-3-flash-preview                                                                                           │ 
│ Sandbox                                                     no sandbox                                                                                                       │ 
│ OS                                                          linux                                                                                                            │ 
│ Auth Method                                                 compute-default-credentials                                                                                      │ 
│ Tier                                                        Gemini Code Assist                                                                                               │ 
│ GCP Project                                                 cloudshell-gca                                                                                                   

</details>

### Login information

qwiklabs gcp lab account. 

### Anything else we need to know?

_No response_

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING