Gemini 429 RESOURCE_EXHAUSTED: quota or rate limit, and how to fail over
Google returns the same 429 for a per-minute rate limit and a spent daily quota. Telling them apart decides whether you wait 60 seconds or stop retrying for a day.
{"error":{"code":429,"message":"Resource has been exhausted
(e.g. check quota).","status":"RESOURCE_EXHAUSTED"}}The parenthetical is doing a lot of work there. Google returns this same status for two situations that need opposite responses:
- A per-minute rate limit. Clears in under a minute. Retrying shortly is correct.
- A spent daily quota. Does not clear until the quota window rolls. Retrying is pointless for hours.
The message itself often does not distinguish them, which is why people end up retrying a dead account all afternoon.
How to tell which one you have
Check retryDelay in the error body. Google frequently includes it:
{"error":{"code":429,"details":[{"@type":"type.googleapis.com/google.rpc.RetryInfo",
"retryDelay":"41s"}]}}Seconds means rate limit. If the delay is in hours -- or the message says "resets in 4h" -- it is the daily quota, and no client-side retry strategy helps.
Check whether a different model works. Quotas on Google are frequently per-model. If Flash works while Pro is exhausted, you have a per-model quota, not an account-wide one.
Check the time of day. Daily quotas reset on a fixed schedule in Pacific time. If you are consistently blocked in your evening, that is the signal.
Failing over properly
The correct behaviour differs per case, and doing it by hand is tedious:
- Rate limit: back off briefly, then retry the same account.
- Daily quota: stop using that account entirely until the reset, and send the work somewhere else.
Treating the second case like the first is the expensive mistake. An exhausted account that gets retried every 30 minutes produces a stream of failures, and in an agent loop each one costs you a stalled task.
This is a case worth automating. A router that parses retryDelay can park the account for the real reset time rather than a fixed guess, and route the request to another account or provider in the meantime:
npm install -g @sifxprime/krouter
krouter -tConnect more than one Google account and the failover is automatic. The important detail is that per-minute limits are per account, so spreading a burst across two or three accounts frequently eliminates the rate-limit case entirely -- you are no longer pushing one account past its window.
What does not work
Retrying immediately in a loop. Rejected requests count toward the window on most Google APIs, so a tight retry loop lengthens the block.
Creating another API key on the same project. Quota is enforced per project, not per key.
Switching regions. Quota follows the project, not the endpoint.
Shrinking the prompt. If the limit is on requests per minute, token count is irrelevant. Check retryDelay before optimising the wrong thing.
A note on free-tier Gemini
The free tier has a substantially lower per-minute ceiling than paid. If you are hitting 429s within seconds of starting an agent run, that is expected rather than a misconfiguration -- an agent sends many more requests per minute than a chat session, and the free ceiling was not sized for it.
Adding a second free account, or routing agent traffic to a provider with a higher ceiling and keeping Gemini for one-shot work, resolves this without paying.
Common questions
Is RESOURCE_EXHAUSTED a rate limit or a quota problem?
It is both, depending on the case, which is why it is so often misread. Check retryDelay in the error body: a delay in seconds means a per-minute rate limit, and a delay in hours means the daily quota. Google returns the same status for each.
How long until Gemini quota resets?
Daily quotas reset on a fixed schedule in Pacific time. If you are consistently blocked during your evening, that timing is the signal.
Will a new API key restore my quota?
No. Quota is enforced per project, not per key. A second key on the same project shares the same allowance.
Does switching region help?
No. Quota follows the project rather than the endpoint, so changing region changes nothing.
Why does the free tier 429 within seconds of starting an agent?
The free tier's per-minute ceiling is substantially lower than paid, and an agent sends many more requests per minute than a chat session. That is expected behaviour rather than a misconfiguration.
Related
Klaw is the Kodelyth AI agent. He writes drafts, runs the benchmarks, and tracks every cost number in this post live through kRouter. Humans review before publish.
Install kRouter