-
Notifications
You must be signed in to change notification settings - Fork 4.2k
AI Gateway: Vertex rejects thought signatures from Google AI Studio on mid-conversation failover #14196
Copy link
Copy link
Open
Labels
ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelrelated to a provider package. Must be assigned together with at least one `provider/*` labelbugSomething isn't working as documentedSomething isn't working as documentedprovider/gatewayIssues related to the @ai-sdk/gateway providerIssues related to the @ai-sdk/gateway providerprovider/googleIssues related to the @ai-sdk/google providerIssues related to the @ai-sdk/google providerprovider/google-vertexIssues related to the @ai-sdk/google-vertex providerIssues related to the @ai-sdk/google-vertex providerreproduction provided
Metadata
Metadata
Assignees
Labels
ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelrelated to a provider package. Must be assigned together with at least one `provider/*` labelbugSomething isn't working as documentedSomething isn't working as documentedprovider/gatewayIssues related to the @ai-sdk/gateway providerIssues related to the @ai-sdk/gateway providerprovider/googleIssues related to the @ai-sdk/google providerIssues related to the @ai-sdk/google providerprovider/google-vertexIssues related to the @ai-sdk/google-vertex providerIssues related to the @ai-sdk/google-vertex providerreproduction provided
Type
Fields
Give feedbackNo fields configured for issues without a type.
Description
When using the AI Gateway with
order: ['google', 'vertex'], mid-conversation provider failover causes Vertex to reject the request with 400: "Unable to submit request because Thought signature is not valid."Steps to reproduce
google/gemini-3-flashwithorder: ['google', 'vertex']in providerOptionsWhat happens
Steps 1-10 run fine on Google AI Studio. Each step generates tool calls with thought signatures. On step 11, Google returns 503. The Gateway tries Vertex as the next provider in the order. Vertex receives the full conversation history including thought signatures generated by Google AI Studio, and rejects them as invalid.
Error from Gateway routing metadata
```json
{
"modelAttemptCount": 1,
"providerAttempts": [
{ "provider": "google", "statusCode": 503, "error": "Service temporarily unavailable" },
{ "provider": "vertex", "statusCode": 400, "error": "Unable to submit request because Thought signature is not valid." }
]
}
```
The full URL Vertex tried to hit: `https://aiplatform.googleapis.com/v1beta1/projects/141030677902/locations/global/publishers/google/models/gemini-3-flash-preview:streamGenerateContent?alt=sse\`
Workaround
Using `only: ['google']` prevents the failover and avoids the error. But this means we lose Vertex as a fallback when Google has capacity issues (503s), which happen regularly with preview models.
We also added `models: ['moonshotai/kimi-k2.5']` as a model-level fallback so when Google 503s, it falls back to a completely different model instead of trying Vertex with incompatible signatures.
Environment
Related issues