Error when talking to Gemini API
The message
Error when talking to Gemini APIWhat it means
A request to Gemini failed and Gemini CLI saved a report about it to a temp file. The line itself doesn't say what failed; the error text after the file path does.
What to do
Read the words after the .json path: fetch failed is your network, API key not valid is your key, a 429 is quota. Fix that one, and keep the report file private.
This is how it looks in a March 2026 report from a Mac:
✖ Error when talking to Gemini API Full report available at: /var/folders/.../T/gemini-client-error-Turn.run-sendMessageStream-2026-03-10T19-50-46-399Z.json TypeError: fetch failed
That line turns up in 103 issues on the Gemini CLI tracker as of September 26, 2026, and it isn't one error. We read where it comes from in the v0.61.0 source. When a request to the model throws, Gemini CLI catches it, writes a report, and prints this fixed sentence with the report's path glued on. Whatever went wrong is the text after the path (TypeError: fetch failed above). The chat also shows it on its own, usually as [API Error: ...].
What's in the report file
The file lands in your system temp folder (/tmp on Linux, a /var/folders/... path on macOS) and is named gemini-client-error-Turn.run-sendMessageStream- plus a timestamp. It holds the error message and stack trace, and also the whole conversation so far plus the request that failed.
That last part matters. The file is easy to attach to a bug report, and it can hold your code and anything you pasted in (plus the contents of every file the model read). Open it and read the error block at the top. Share that block if you need help, not the file.
Reading the error after the path
These are the tails that come up most in the tracker, and where each one points:
TypeError: fetch failedorexception TypeError: fetch failed sending request: the request never got an answer. It's the network, a proxy, a VPN or a firewall between you and Google. A maintainer grouped these under #17518 as "intermittentfetch failed/Headers Timeout Errorissues", and that thread was closed in a May cleanup without a fix being named. Try again on another connection before anything else.API key not valid(a 400): the key is wrong, deleted or restricted. A maintainer's first suggestion in #26620 was to generate a new one. Our page on “API key not valid” goes through the causes.- 429,
RESOURCE_EXHAUSTEDorMODEL_CAPACITY_EXHAUSTED: quota or a busy model. See 429 RESOURCE_EXHAUSTED and “Usage limit reached for all Pro models”. - 403
PERMISSION_DENIEDor "The caller does not have permission": the account or Google Cloud project can't use that model. Several April reports came from paid Google One AI Ultra and Google AI Pro accounts (#25603 is one), so paying doesn't rule it out. “Failed to sign in” covers the project settings. Request contains an invalid argument.(400): the API refused the request as malformed. Starting a fresh session with/cleartells you whether something in the conversation caused it.
When it keeps happening
A sign-in problem isn't wrapped this way (the code rethrows it so you get a login prompt), so if you see this line the CLI thinks you're signed in. Run /about and note the version, model and auth type it lists, because that's the first thing anyone will ask for.
If your company sends API traffic through its own endpoint, Gemini CLI reads GOOGLE_GEMINI_BASE_URL (and GOOGLE_VERTEX_BASE_URL for Vertex AI) to send requests through a different endpoint. For a report upstream, the Gemini CLI team asks for /about output and reproduction steps, and several of these threads closed for lack of them.
Other lines the same feature prints
Match yours against these if the one at the top of the page is not quite it. They come from the same code and mean related things.
Error when talking to Gemini API Full report available at: /tmp/gemini-client-error-Turn.run-sendMessageStream-.jsonError when talking to Gemini API Full report available at:gemini-client-error-Turn.run-sendMessageStream[API Error: exception TypeError: fetch failed sending request]