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
[BUG]: Type validation failed for billing.summary SSE event from SiliconFlow-compatible providers #39087
When using a provider that injects billing metadata into the SSE stream (e.g., SiliconFlow-compatible APIs), opencode crashes with a type validation error because the response schema only accepts choices array or error object, but billing summary events have neither.
The SSE stream response validation uses a union type expecting either:
A successful response with a choices array, OR
An error response with an error object
Providers like SiliconFlow inject extra SSE events with "object": "billing.summary" at the end of the stream. These are not part of the OpenAI spec and cause a hard validation failure instead of being silently ignored.
Expected Behavior
Unknown SSE event object types (e.g., billing.summary) should be silently ignored rather than throwing a validation error.
Steps to Reproduce
Configure opencode with a SiliconFlow-compatible provider
Send any chat request
Observe the Type validation failed error in the output
Environment
Provider: SiliconFlow-compatible API (injects billing.summary into SSE stream)
Activity
github-actions commentedon Jul 27, 2026
This issue might be a duplicate of existing issues. Please check:
event:field — custom server events crash Chat Completions stream with TypeValidationError #38106: Same root cause — non-standard SSE frames from a custom OpenAI-compatible provider bypass theevent:field and hit the Chat Completions chunk validator, producing the identicalinvalid_union/TypeValidationErrorcrash.invalid_unionvalidation failure pattern from non-standard SSE data injected into the stream.chatcmpl-dummyframe causingTypeValidationError#30916: Same class of bug — an unexpected SSE frame type causes aTypeValidationErrorand terminates the agent turn.If your issue is distinct (e.g. specific to
billing.summaryframes and not addressed by fixes for the above), please note that in a comment.hoanghjx commentedon Jul 27, 2026
github-actions commentedon Sep 26, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.