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
Stream error only written to log, never surfaced to client — session appears to “hang” (opencode as external agent in zed) #58496
When the free-tier usage limit is reached, opencode logs the failure at ERROR level but does not surface it to the connected client, so the session appears to hang indefinitely (rotating activity indicator) with no error in the UI.
Environment
opencode used as an external agent inside zed (not the desktop app / TUI)
No error is shown in the zed agent panel — the UI just keeps showing the activity/"thinking" indicator until the session dies
What I expected
The AI_APICallError (free usage limit reached) should be delivered to the client as a terminal/error event in the stream so the UI can display it, instead of the request failing silently and looking like a hang.
What actually happens
Only the log records the failure:
timestamp=2026-10-23T16:15:17.416Z level=ERROR run=d604f7ec message="stream error"
providerID=opencode modelID=deepseek-v4.1-flash-free
session.id=ses_e96767435ffeePRhPa3eNG6YPX small=false agent=build mode=primary
error.error="AI_APICallError: Free usage limit reached. Subscribe to OpenCode Go
to keep going: https://opencode.ai/go"
The stream errors out and opencode swallows the error (log-only), so the client (zed) never receives it and keeps spinning.
When a stream fails with a terminal error (e.g. AI_APICallError / usage limit), propagate the error to the client (SSE/ACP error event) so external agents surface it, rather than only logging it and leaving the session hanging.
Thanks for the detailed report! Your log line (message="stream error" with providerID/modelID/session.id/small/agent/mode) matches the format OpenCode v1 (opencode-ai, 0.x/1.x) uses. v2 logs differently. v1 now only gets fixes for critical bugs, so this is unlikely to be fixed there.
The good news is that v2 should already behave the way you expect. The same problem was reported for v1 in #47804, and on v2 free and Go usage-limit errors are treated as quota errors and not retried. So the ACP prompt fails right away with the provider's message, and Zed can show it instead of spinning. Errors that are retried show up as retry status (#50752). To upgrade: opencode upgrade --major (details: https://anoma.ly/notes/opencode-2-0). Then check opencode --version shows 2.x, including for the binary Zed launches.
AI-assisted offline check on the exact v2.1.4 tag (68bc26b7): I ran the real ACP CLI/private server through the repository's subprocess fixture, with a local HTTP endpoint returning either:
HTTP 429 with error.type: "FreeUsageLimitError" and your usage-limit message;
HTTP 200 SSE containing the same error, followed by [DONE].
Both session/prompt requests completed with JSON-RPC error -32603, data.errorName: "provider.free-limit", and the user-facing “Free usage limit reached…” message. This was a simulated provider, with no real credentials or model calls; it does not reproduce your Zed instance.
The v2.1.4 ACP handler starts its own private server. Could you share the executable path/command configured for the Zed agent, and the version reported by that exact executable? A matching session/prompt JSON-RPC response or unresolved request would help distinguish the remaining client/launch-path issue from provider error propagation.
Closing this as not planned. Your log points to OpenCode v1, which now only gets fixes for critical bugs, and we haven't heard that it also happens on v2.
On v2, free and Go usage-limit errors are no longer retried, so the ACP prompt fails right away and Zed can show the provider's message (see #47804 and #50752). To upgrade: opencode upgrade --major (https://anoma.ly/notes/opencode-2-0). Make sure the binary Zed launches also reports 2.x.
If you still see the hang on v2, please open a new issue or reply here with your opencode --version and the matching log. Thanks again for the detailed report!
Thanks for checking again! The log you posted after upgrading (message="stream error" … small=false agent=build mode=primary) is still written by OpenCode v1. v2 has no such log line. So the opencode that Zed starts is v1, even though opencode acp --version in your terminal reports 2.1.4.
This usually comes from Zed's ACP registry: the opencode entry may still install v1, and v2 has its own opencode-v2 entry. You can either:
switch to opencode-v2 in Zed's agent registry, or
point Zed at your v2 binary explicitly in ~/.config/zed/settings.json: under agent_servers, set "command": "/full/path/to/opencode", "args": ["acp"].
On v2 we tested the free-usage-limit error over a real opencode acp process, both as an HTTP 429 and as an error inside the response stream. In both cases session/prompt fails straight away with "Free usage limit reached…" (provider.free-limit), so Zed can show it.
Closing this since it doesn't happen on v2. If it still spins after switching, please reply with the exact command or path Zed launches and the log from that process (it should show a v2 version), and we'll reopen.
Activity
opencode-agent commentedon Oct 23, 2026
Thanks for the detailed report! Your log line (
message="stream error"withproviderID/modelID/session.id/small/agent/mode) matches the format OpenCode v1 (opencode-ai, 0.x/1.x) uses. v2 logs differently. v1 now only gets fixes for critical bugs, so this is unlikely to be fixed there.The good news is that v2 should already behave the way you expect. The same problem was reported for v1 in #47804, and on v2 free and Go usage-limit errors are treated as quota errors and not retried. So the ACP prompt fails right away with the provider's message, and Zed can show it instead of spinning. Errors that are retried show up as retry status (#50752). To upgrade:
opencode upgrade --major(details: https://anoma.ly/notes/opencode-2-0). Then checkopencode --versionshows 2.x, including for the binary Zed launches.Related issues:
If you still see this on v2, or think it's critical, please reply here with your
opencode --versionand the matching log, and we'll take another look.carygravel commentedon Oct 23, 2026
I've upgraded to v2, but I still see the same issue. Here is the log:
But the error didn't surface
r266-tech commentedon Oct 23, 2026
AI-assisted offline check on the exact
v2.1.4tag (68bc26b7): I ran the real ACP CLI/private server through the repository's subprocess fixture, with a local HTTP endpoint returning either:error.type: "FreeUsageLimitError"and your usage-limit message;[DONE].Both
session/promptrequests completed with JSON-RPC error-32603,data.errorName: "provider.free-limit", and the user-facing “Free usage limit reached…” message. This was a simulated provider, with no real credentials or model calls; it does not reproduce your Zed instance.The v2.1.4 ACP handler starts its own private server. Could you share the executable path/command configured for the Zed agent, and the version reported by that exact executable? A matching
session/promptJSON-RPC response or unresolved request would help distinguish the remaining client/launch-path issue from provider error propagation.opencode-agent commentedon Oct 24, 2026
Closing this as not planned. Your log points to OpenCode v1, which now only gets fixes for critical bugs, and we haven't heard that it also happens on v2.
On v2, free and Go usage-limit errors are no longer retried, so the ACP prompt fails right away and Zed can show the provider's message (see #47804 and #50752). To upgrade:
opencode upgrade --major(https://anoma.ly/notes/opencode-2-0). Make sure the binary Zed launches also reports 2.x.If you still see the hang on v2, please open a new issue or reply here with your
opencode --versionand the matching log. Thanks again for the detailed report!neriousy commentedon Nov 5, 2026
Thanks for checking again! The log you posted after upgrading (
message="stream error" … small=false agent=build mode=primary) is still written by OpenCode v1. v2 has no such log line. So the opencode that Zed starts is v1, even thoughopencode acp --versionin your terminal reports 2.1.4.This usually comes from Zed's ACP registry: the
opencodeentry may still install v1, and v2 has its ownopencode-v2entry. You can either:opencode-v2in Zed's agent registry, or~/.config/zed/settings.json: underagent_servers, set"command": "/full/path/to/opencode", "args": ["acp"].On v2 we tested the free-usage-limit error over a real
opencode acpprocess, both as an HTTP 429 and as an error inside the response stream. In both casessession/promptfails straight away with "Free usage limit reached…" (provider.free-limit), so Zed can show it.Closing this since it doesn't happen on v2. If it still spins after switching, please reply with the exact command or path Zed launches and the log from that process (it should show a v2 version), and we'll reopen.