[API Error: Model stream ended with empty response text.]
Gemini CLI returns an empty stream, or crashes reading `candidates` off an undefined response. Both are the same class of failure and both are worth retrying rather than debugging.
Active issue
0 confirmations · 2 environments
- Applies through
- reported through 0.53.1
- Applies to
- Gemini CLI reported through 0.53.1
- Environments
- More frequent at peak hours and on free-tier quota · All
- Severity
- Medium
Filed by nadia.codes · Jul 25, 2026
No verified fix yet
Nobody has recorded a working fix for this issue. If you found one, it belongs here — and if you tried something that failed, that is worth recording too.
Members' reports are attributed. Anonymous ones are counted separately.
Does it still happen?
What each release of Gemini CLI has been reported to do with this issue.
- 0.49.0Not yet tested— running Gemini CLI 0.49.0? Tell us below.
- 0.53.0Not yet tested— running Gemini CLI 0.53.0? Tell us below.
- 0.53.1Still affected — 2 reports
Why this happens
Three messages that show up together and share a root cause:
✕ [API Error: Model stream ended with empty response text.]
✕ [API Error: Model stream ended with an invalid chunk or missing finish reason.]
API Error: Cannot read properties of undefined (reading 'candidates')The third is the same failure reaching an unguarded property access instead of the error path, so it reads like a client bug. Under load you will also see The model is overloaded. Please try again later. (503) and plain 429s. Retrying the identical prompt usually succeeds.
Likely causeThe response stream terminates without a finish reason — capacity shedding upstream rather than anything about the prompt. The CLI does not uniformly guard against an empty candidates array, so some paths surface a clean API error and others throw a TypeError.
Confirmed environments2
| Agent | Version | Model | OS | Framework | Outcome |
|---|---|---|---|---|---|
| Gemini CLI | 0.53.1 | Gemini 3.6 Flash | macOS 15.5 | — | Reproduced |
| Gemini CLI | 0.53.1 | Gemini 3.5 Flash | Ubuntu 24.04 | — | Reproduced |
Approaches that failed1
Shrinking the prompt
Assumed it was a context problem and cut the prompt by two thirds. No change — a one-line prompt fails just as readily at peak hours.
theotv · 6d ago
Other approaches that worked1
Retry, then fall back a tierpartial
Two retries clear it most of the time. When they don't, switching to a Flash-Lite tier for the same task succeeds — which points at capacity rather than the request.
nadia.codes · 6d ago
Discussion · 1 comment
Strong evidence gets promoted into the record above.
Sign in to join the discussion, vote, and verify fixes.
Related pages
The
Cannot read properties of undefined (reading 'candidates')variant sends people down a rabbit hole looking for a bug in their own tooling, because it looks like a JavaScript error rather than a service one. It isn't. Same cause, worse error handling.