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

unexpectedly quit: API Error: exception TypeError: fetch failed sending request

Open MichaelSimoneau opened this issue 1 month ago • 3 comments

What happened?

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ ✓ ReadFile storefront/src/components/Scene.tsx │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ✕ [API Error: exception TypeError: fetch failed sending request]

What did you expect to happen?

it to read and update the file

Client information

  • CLI Version: 0.17.1
  • Git Commit: 1d51935fc
  • Session ID: ae4626cf-b684-41e5-bc5b-8dcb227c3d0d
  • Operating System: linux v22.21.1
  • Sandbox Environment: no sandbox
  • Model Version: pro
  • Memory Usage: 517.2 MB

Login information

google ai pro account, google login

Anything else we need to know?

You're amazing!... that's all. carry on.

MichaelSimoneau avatar Nov 22 '25 15:11 MichaelSimoneau

Found possible duplicate issues:

  • #12205
  • #10941

If you believe this is not a duplicate, please remove the status/possible-duplicate label.

gemini-cli[bot] avatar Nov 22 '25 15:11 gemini-cli[bot]

Hi @MichaelSimoneau, could you provide a little bit more information, does this happen frequently or was this a one off? Also if you're able to get this to reproduce frequently, if you could provide repro steps that would be great!

Also could you try the latest stable to see if this happens there as well.

galz10 avatar Dec 01 '25 20:12 galz10

I am having the same issue. It seems that I mainly have this issue when asking a very complex question with many reference files. After retrying a couple of times, it seems to have resolved itself. When having the error, the debug logs showed:

    at async                                                                                                                     │
│  file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/d │
│  ist/src/core/loggingContentGenerator.js:116:26                                                                                   │
│      at async runInDevTraceSpan                                                                                                   │
│  (file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/ │
│  dist/src/telemetry/trace.js:33:16)                                                                                               │
│      at async retryWithBackoff                                                                                                    │
│  (file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/ │
│  dist/src/utils/retry.js:75:28)                                                                                                   │
│      at async GeminiChat.makeApiCallAndProcessStream                                                                              │
│  (file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/ │
│  dist/src/core/geminiChat.js:323:32)                                                                                              │
│      at async                                                                                                                     │
│  file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/d▄│
│  ist/src/core/geminiChat.js:234:40                                                                                               █│
│      at async Turn.run                                                                                                           █│
│  (file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/█│
│  dist/src/core/turn.js:60:30) {                                                                                                  █│
│    status: 503                                                                                                                   █│
│  }                                                                                                                               █│
│ ✖ Error when talking to Gemini API Full report available at:                                                                     █│
│   /var/folders/tx/vgd9pnrj3s34gdwfstx6lq_80000gn/T/gemini-client-error-Turn.run-sendMessageStream-2025-12-02T14-27-50-404Z.json  

I can send you the whole file over in case needed, but it contains sensitive info of my repo. A part of it:

{
  "error": {
    "message": "exception TypeError: fetch failed sending request",
    "stack": "Error: exception TypeError: fetch failed sending request\n    at file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/genai/dist/node/index.mjs:11550:19\n    at async Models.generateContentStream (file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/genai/dist/node/index.mjs:12859:24)\n    at async file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/loggingContentGenerator.js:116:26\n    at async runInDevTraceSpan (file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/telemetry/trace.js:33:16)\n    at async retryWithBackoff (file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/utils/retry.js:75:28)\n    at async GeminiChat.makeApiCallAndProcessStream (file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/geminiChat.js:323:32)\n    at async file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/geminiChat.js:234:40\n    at async Turn.run (file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/turn.js:60:30)\n    at async GeminiClient.sendMessageStream (file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/client.js:366:26)\n    at async file:///opt/homebrew/Cellar/gemini-cli/0.18.4/libexec/lib/node_modules/@google/gemini-cli/dist/src/ui/hooks/useGeminiStream.js:485:26"
  },
  "context": [
... ]

Client information CLI Version 0.18.4
Git Commit 2e8d7831c
Model auto
Sandbox no sandbox
OS darwin
Auth Method gemini-api-key
User Email
GCP Project
IDE Client VS Code

JordyHeusdensDT avatar Dec 02 '25 14:12 JordyHeusdensDT