Skip to content

Unhandled Promise Rejection: "TypeError: fetch failed" in Gemini CLI (Undici / StreamableHTTPClientTransport) #13820

@lifevideogame

Description

@lifevideogame

What happened?

Running the Gemini CLI triggers an unhandled Promise rejection. The CLI itself prints:

“This is an unexpected error. Please file a bug report using the /bug tool.”

The error appears to originate from the HTTP transport layer used by @google/gemini-cli and @modelcontextprotocol/sdk. Here is the exact output:

This is an unexpected error. Please file a bug report using the /bug tool.
CRITICAL: Unhandled Promise Rejection!

Reason: TypeError: fetch failed
Stack trace:
TypeError: fetch failed
at /home/lucia/.nvm/versions/node/v20.19.4/lib/node_modules/@google/gemini-cli/node_modules/undici/index.js:124:13
at async file:///home/lucia/.nvm/versions/node/v20.19.4/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/ide/ide-client.js:512:30
at async StreamableHTTPClientTransport.send (file:///home/lucia/.nvm/versions/node/v20.19.4/lib/node_modules/@google/gemini-cli/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js:278:30) (x2)

What did you expect to happen?

The Gemini CLI should gracefully handle network/transport failures instead of throwing an unhandled Promise rejection. Ideally, the error should be caught and surfaced with a stable error message rather than a crash coming from Undici and StreamableHTTPClientTransport.

Client information

  • CLI Version: 0.17.1
  • Git Commit: 1d51935
  • Session ID: fd3a5c20-f260-473c-9993-ec1d49049b1a
  • Operating System: linux v20.19.4
  • Sandbox Environment: no sandbox
  • Model Version: auto
  • Memory Usage: 337.2 MB
  • IDE Client: VS Code

Login information

No response

Anything else we need to know?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues related to User Interface, OS Support, Core Functionalitypriority/p0Critical and urgent (e.g., critical security vulnerability, major breakage).status/possible-duplicate

    Type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions