This setup was working correctly just a few days ago, and I haven't changed anything in my code or dependencies since then.
"@ai-sdk/google-vertex": "^2.2.18",
"ai": "^4.3.13"
Error details:
`_err _TypeValidationError [AI_TypeValidationError]: Type validation failed: Value: {"candidates":[{"content":{"role":"model","parts":[{"inlineData":{"mimeType":"image/png","data":"iVBORw0KGgoAAAANSUhEUgAABAAAAAIxCAIAAABciV3mAAAAiXpUWHRSYXcgcHJvZmlsZSB0eXBlIGlwdGMAAAiZTY...."
cause: ZodError: [
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"candidates",
0,
"safetyRatings",
0,
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"candidates",
0,
"safetyRatings",
0,
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"candidates",
0,
"safetyRatings",
1,
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"candidates",
0,
"safetyRatings",
1,
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"candidates",
0,
"safetyRatings",
2,
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"candidates",
0,
"safetyRatings",
2,
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"candidates",
0,
"safetyRatings",
3,
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"candidates",
0,
"safetyRatings",
3,
],
"message": "Required"
}
]
`
Description
I'm running into a
TypeValidationErrorwhen using thegemini-2.0-flash-expmodel via@ai-sdk/google-vertex. This model is multimodal and returns both text and image responses. The issue occurs only when the model responds with an image (in base64); text-only responses work fine.This setup was working correctly just a few days ago, and I haven't changed anything in my code or dependencies since then.
Package versions: