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
When using OpenCode, API connections intermittently fail with:
Cannot connect to API: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()
This error surfaces raw fetch() internals to the user rather than providing a meaningful error message or automatic recovery. While similar issues exist (#21643 for Zen models on QEMU, #22803 for SGLang ECONNRESET during streaming), this issue covers the general case where the underlying connection drops for any provider — including standard OpenAI/Anthropic endpoints on stable networks.
The core problem is that OpenCode does not gracefully handle transient socket closures. Expected behavior would be:
Description
When using OpenCode, API connections intermittently fail with:
This error surfaces raw
fetch()internals to the user rather than providing a meaningful error message or automatic recovery. While similar issues exist (#21643 for Zen models on QEMU, #22803 for SGLang ECONNRESET during streaming), this issue covers the general case where the underlying connection drops for any provider — including standard OpenAI/Anthropic endpoints on stable networks.The core problem is that OpenCode does not gracefully handle transient socket closures. Expected behavior would be:
Plugins
none
OpenCode version
1.4.6
Steps to reproduce
This is difficult to reproduce deterministically as it depends on network conditions, but occurs regularly in practice.
Screenshot and/or share link
No response
Operating System
Linux (various distributions)
Terminal
various