You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
All Mistral models fail with ZodError: "finish" expected string, received object #5981
All Mistral provider models fail with a ZodError validation error after successfully generating a response. The error occurs during stream parsing when the AI SDK validates the finish field.
Steps to Reproduce
# Any Mistral model fails:
opencode run -m mistral/ministral-3b-latest "say hi"< /dev/null
opencode run -m mistral/mistral-small-latest "say hi"< /dev/null
opencode run -m mistral/mistral-large-latest "say hi"< /dev/null
Expected Behavior
Command completes successfully after generating response.
Actual Behavior
Response generates correctly, then immediately fails with validation error:
{"type":"text","timestamp":...,"part":{"type":"text","text":"Hi"}}
{"type":"error","timestamp":...,"error":{"name":"UnknownError","data":{"message":"[{\"code\":\"invalid_union\",\"errors\":[[{\"expected\":\"string\",\"code\":\"invalid_type\",\"path\":[\"reason\"],\"message\":\"Invalid input: expected string, received object\"}],...]}"}}}
Root Cause Analysis
The Vercel AI SDK expects the Mistral stream to return {"finish": "stop"} (string), but Mistral's API returns {"finish": {"reason": "stop"}} (object). This causes Zod validation to fail.
This appears to be a unique issue specific to Mistral's API response format for the stream finish field.
While there is a related issue #5034 about Ministral 3 support, that issue addresses a different error (system message role error) rather than the ZodError validation issue with the finish field.
This issue is distinct from other provider validation errors in the codebase, as it specifically stems from Mistral's API returning {"finish": {"reason": "stop"}} (object) while the Vercel AI SDK expects {"finish": "stop"} (string).
Recommendation: This appears to be a fresh/unique issue that may require a custom Mistral provider adapter or upstream fix in the Vercel AI SDK's Mistral integration.
Release is in progress. w/ desktpp stuff it takes a while and some of the npm stuff is getting 503'ed so im doing waht I can but blocked until release goes out :/
Reacted by Ray Arayilakath, Chindriș Mihai - Alexandru and Maaz Chowdhry
Activity
github-actions commentedon Dec 22, 2025
This appears to be a unique issue specific to Mistral's API response format for the stream finish field.
While there is a related issue #5034 about Ministral 3 support, that issue addresses a different error (system message role error) rather than the ZodError validation issue with the finish field.
This issue is distinct from other provider validation errors in the codebase, as it specifically stems from Mistral's API returning
{"finish": {"reason": "stop"}}(object) while the Vercel AI SDK expects{"finish": "stop"}(string).Recommendation: This appears to be a fresh/unique issue that may require a custom Mistral provider adapter or upstream fix in the Vercel AI SDK's Mistral integration.
nimitbhardwaj commentedon Dec 22, 2025
I am also facing this error also for GROQ related models. I am using gpt oss 120b with groq and its not working on opencode.
Vicenzo-Giuseppe commentedon Dec 22, 2025
me too all groq models fails too.
rekram1-node commentedon Dec 22, 2025
can anyone show me:
cat ~/.cache/opencode/package.jsonrekram1-node commentedon Dec 22, 2025
looks like ai sdk v6 released just now and it busts the cached versions, looking into fix
rayhanadev commentedon Dec 22, 2025
not sure if you still need it but here you go:
rekram1-node commentedon Dec 22, 2025
Will release fix shortly:
https://github.com/sst/opencode/commits/dev/
I think this should get it fixed
rayhanadev commentedon Dec 22, 2025
ty goat 👑
rekram1-node commentedon Dec 22, 2025
Release is in progress. w/ desktpp stuff it takes a while and some of the npm stuff is getting 503'ed so im doing waht I can but blocked until release goes out :/
rekram1-node commentedon Dec 22, 2025
welp:
https://www.githubstatus.com/
now github is down
rekram1-node commentedon Dec 22, 2025
after 3 yrs of waiting it finally deployed. Latest should have fix