gemini-cli - 💡(How to fix) Fix ioctl(2) failed, EBADF

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

  • Error: Error: ioctl(2) failed, EBADF (Bad File Descriptor).
  • Context: The stack trace indicates that a React-style hook (commitPassiveMountOnFiber) triggered a PTY resize while the shell execution was active. The EBADF error suggests that the file descriptor for the pseudo-terminal was either invalid, already closed, or not properly initialized when the resize was attempted.

The shell command (chmod +x ...) should have executed successfully without crashing the application. I expected the CLI to remain stable and return the command's output (or exit code) so the agent could proceed to the next task. The internal terminal management (PTY) should handle resizing and initialization gracefully without throwing EBADF or triggering a critical process-level error.

RAW_BUFFERClick to expand / collapse

What happened?

While the Gemini CLI was executing a shell command (chmod +x docker/bin/entrypoint.sh), it encountered a critical crash in the underlying terminal handling logic.

Technical Details:

  • Error: Error: ioctl(2) failed, EBADF (Bad File Descriptor).
  • Location: The failure occurred inside node-pty (unixTerminal.js:243:13) during a pty.resize operation.
  • Context: The stack trace indicates that a React-style hook (commitPassiveMountOnFiber) triggered a PTY resize while the shell execution was active. The EBADF error suggests that the file descriptor for the pseudo-terminal was either invalid, already closed, or not properly initialized when the resize was attempted.
  • Impact: The CLI process terminated unexpectedly, although the shell command itself may have been sent to the OS before the crash.

chat_export.json

What did you expect to happen?

The shell command (chmod +x ...) should have executed successfully without crashing the application. I expected the CLI to remain stable and return the command's output (or exit code) so the agent could proceed to the next task. The internal terminal management (PTY) should handle resizing and initialization gracefully without throwing EBADF or triggering a critical process-level error.

Client information

  • CLI Version: 0.44.0
  • Git Commit: 1000b33d4
  • Session ID: 2521dd80-4e95-4aad-8b8f-8feae28b5ea2
  • Operating System: linux v20.20.2
  • Sandbox Environment: no sandbox
  • Model Version: auto
  • Auth Type: oauth-personal
  • Memory Usage: 281.5 MB
  • Terminal Name: VTE(7600)
  • Terminal Background: #222b30
  • Kitty Keyboard Protocol: Unsupported

Login information

I'm logged in through my Google 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