fix: detect embedded 429 errors from Gemini/VertexAI APIs#10674
Open
fix: detect embedded 429 errors from Gemini/VertexAI APIs#10674
Conversation
Gemini and VertexAI can return rate-limit errors where the HTTP status is not 429 but the error code is embedded in the response body JSON (e.g., "code":429). Add regex-based detection of these embedded errors in both retry paths so they trigger exponential backoff correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"code":429) while the HTTP status code is not 429/"code"\s*:\s*429/) in bothwithExponentialBackoffanddefaultShouldRetryso these embedded errors trigger retry with backoff"code":429(no space) and"code": 429(with space) variantsTest plan
"code":429in message is retried"code": 429(with space) in message is retriedContinue Tasks: ❌ 7 failed — View all
Summary by cubic
Detects embedded 429 rate-limit errors in Gemini/VertexAI responses so retries with exponential backoff trigger even when the HTTP status isn’t 429. This reduces failed calls and improves reliability with these APIs.
"code": 429in error messages in both withExponentialBackoff and defaultShouldRetry.Written for commit 9759ad6. Summary will update on new commits.