opencode
opencode copied to clipboard
AIHubMix provider: streaming completes output but errors near end with ZodError (invalid_union: reason/part/delta)
Description
When using the built-in AIHubMix provider, OpenCode can stream most of the assistant output, but near the end of the stream it throws a ZodError and marks the request as failed.
The error is an invalid_union with fields like:
path ["reason"]: expected string, received object
path ["part"]: expected object, received undefined
path ["delta"]: expected string, received undefined
I use the built-in provider XIAOMI now, and it just works well.
Plugins
at first with oh-my-opencode, and it can be reproduced with none
OpenCode version
1.1.8, and can be reproduced in 1.1.6 and 1.1.1
Steps to reproduce
Use the bulit-in AIHubMix provider:
- Select an AIHubMix model.
- Send any prompt (e.g. hello / 你好?).
- Observe streaming output appears, then near completion OpenCode throws ZodError. Model tested:
- Claude Haiku 4.5 (built-in)
- GPT-5.2 (built-in)
- glm-4.7 (built-in)
- grok-4-1-fast-non-reasoning(added by myself)
- gemini-3-flash-preview (added by myself)
Screenshot and/or share link
Operating System
Ubuntu 24.04, in WSL2
Terminal
Windows Terminal