Open Source & Case StudiesVERCEL AI SDK · OPEN SOURCE
MERGED UPSTREAM

Preserving Structured Gemini Error Details in Vercel AI SDK

A reproduced Google-provider error-schema defect, focused patch, and regression fixture that Vercel approved and transferred into factory PR #18662, merged upstream on August 11, 2026.

Role

  • Provider error analysis
  • Schema engineering
  • Regression testing
  • Backward-compatibility review
  • Open-source collaboration

Category

Provider Reliability

Engineering discipline

MERGED UPSTREAM

Merged upstream:Vercel PR #18662
Original contribution:PR #18629 · approved
Regression path:Gemini HTTP 429
Patrick Ribbsaeter Vercel AI SDK Gemini error details fix merged upstream in PR #18662

Patrick Ribbsaeter · Independent open-source contribution

Engineering objective

System challenge

Gemini 429 responses can carry google.rpc.QuotaFailure and google.rpc.RetryInfo payloads, but the Google provider schema stripped error.details before the parsed response reached APICallError.data. Applications therefore lost provider-supplied retry timing unless they reparsed the raw response body.

Constraints

Working within real limits

  • Preserve arbitrary Google RPC detail payloads without over-modeling provider variants
  • Keep existing status, retryability, messages, headers, and successful responses unchanged
  • Prove the fix through the real failed-response handler rather than a schema-only assertion
  • Represent the transfer accurately: PR #18629 reported the fix; factory PR #18662 merged it

Architecture

System design

HTTP response
Validate
Preserve details
Primary flow
Restricted path
External dependency
Data path

Approach

How it was built

  1. 01

    Reproduced the detail loss through the existing Google failed-response handler.

  2. 02

    Extended the schema with a nullish array of unknown detail payloads.

  3. 03

    Added a representative Gemini 429 fixture containing QuotaFailure, RetryInfo, and retryDelay 34.4s.

  4. 04

    Verified that both structured entries survive parsing into APICallError.data.

  5. 05

    Kept the patch additive and isolated to the Google provider’s existing error path.

Workflow

Implementation flow

Capture representative Gemini quota response
Parse through googleFailedResponseHandler
Retain unknown Google RPC detail objects
Expose RetryInfo in APICallError.data
Replay original reproduction
Transfer approved patch into Vercel factory PR

Technical validation

Implementation evidence

Observable engineering evidence. Discipline: MERGED UPSTREAM

Merged upstream

Vercel PR #18662

Original contribution

PR #18629 · approved

Regression path

Gemini HTTP 429

Reviewed risk

Low / additive

Public evidence

Review the upstream contribution

Outcome

What was delivered

  • Vercel factory PR #18662 merged the accepted fix upstream on August 11, 2026

  • Vercel’s bugfix review marked the issue fully addressed with low side-effect and security risk

  • The original reproduction no longer reproduced against the factory implementation

  • Structured QuotaFailure and RetryInfo values now survive parsing without changing retry policy

Technologies

Stack and tools

TypeScriptVercel AI SDKGoogle GeminiZodVitestHTTP error handlingGoogle RPCProvider schemas

Next engineering system

ANTHROPIC SDK · PUBLIC VALIDATION

Anthropic SDK: Stable Client Identity

Have an ambitious AI system to build?

Let’s build something serious.

I work across AI architecture, product engineering, private inference, automation, SaaS infrastructure, and production hardening.