Skip to content

Comments

fix: detect embedded 429 errors from Gemini/VertexAI APIs#10674

Open
RomneyDa wants to merge 1 commit intomainfrom
gemini-429
Open

fix: detect embedded 429 errors from Gemini/VertexAI APIs#10674
RomneyDa wants to merge 1 commit intomainfrom
gemini-429

Conversation

@RomneyDa
Copy link
Collaborator

@RomneyDa RomneyDa commented Feb 20, 2026

Summary

  • Gemini and VertexAI APIs can return 429 rate-limit errors embedded in the response body JSON ("code":429) while the HTTP status code is not 429
  • Added regex-based detection (/"code"\s*:\s*429/) in both withExponentialBackoff and defaultShouldRetry so these embedded errors trigger retry with backoff
  • Added two tests covering "code":429 (no space) and "code": 429 (with space) variants

Test plan

  • Existing retry tests pass
  • New test: error with "code":429 in message is retried
  • New test: error with "code": 429 (with space) in message is retried

Continue 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.

  • Bug Fixes
    • Detect "code": 429 in error messages in both withExponentialBackoff and defaultShouldRetry.
    • Add tests for no-space and spaced variants of the embedded code.

Written for commit 9759ad6. Summary will update on new commits.

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.
@RomneyDa RomneyDa requested a review from a team as a code owner February 20, 2026 08:31
@RomneyDa RomneyDa requested review from sestinj and removed request for a team February 20, 2026 08:31
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 20, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant