Repository navigation
Description
Description
Running plain opencode (v2.0.7, macOS ARM64, Bun install) fails during startup at Starting background server... with an UnknownError from Effect.tryPromise in Tui.run, caused by ClientError: Transport / TypeError: Unable to connect. Is the computer able to access the url?.
This looks like the TUI trying to connect to the managed background service before it is healthy, then surfacing only the generic Transport error. Related to #41696 / #41746 / #49034 / #49209 which are all Timed out waiting for the background service to start, but this case throws immediately with UnknownError instead of a timeout, and the log shows Server process exited with code 130 in a restart loop.
Example 1 — terminal output (opencode)
opencode
Starting background server...
[04:51:05.524] ERROR (#1): UnknownError: An error occurred in Effect.tryPromise
at <anonymous> (/$bunfs/root/chunk-0vyg89f2.js:24:5598)
at ~effect/Utils/internal (/$bunfs/root/chunk-0vyg89f2.js:8:1540)
at s (/$bunfs/root/chunk-0vyg89f2.js:24:5696)
at processTicksAndRejections (native:7:39)
at Tui.run (/$bunfs/root/chunk-830qaeq5.js:98:247)
at Tui.run (definition) (/$bunfs/root/chunk-830qaeq5.js:93:17047) {
[cause]: ClientError: Transport
at <anonymous> (/$bunfs/root/chunk-0vaztdxa.js:2:817)
at async <anonymous> (/$bunfs/root/chunk-0vaztdxa.js:2:1038)
at processTicksAndRejections (native:7:39) {
[cause]: TypeError: Unable to connect. Is the computer able to access the url?
at async <anonymous> (/$bunfs/root/chunk-0vaztdxa.js:2:781)
at async <anonymous> (/$bunfs/root/chunk-0vaztdxa.js:2:1038)
}
}
Example 2 — ~/.local/share/opencode/log/opencode.log (redacted, role=cli)
Repeated loop, same run window:
timestamp=2026-09-18T01:54:49.793Z level=INFO run=b026c062 message="cli starting" version=2.0.7 channel=latest local=false args=[] role=cli
timestamp=2026-09-18T01:54:49.821Z level=INFO run=b026c062 message="background service starting" reason=missing previousVersion=undefined role=cli
timestamp=2026-09-18T01:54:50.099Z level=INFO run=b026c062 message="event stream connecting" component=client attempt=0 role=cli
timestamp=2026-09-18T01:54:50.228Z level=INFO run=b026c062 message="event stream disconnected" component=client attempt=1 error=Transport role=cli
timestamp=2026-09-18T01:54:50.583Z level=INFO run=b026c062 message="event stream connecting" component=client attempt=1 role=cli
timestamp=2026-09-18T01:54:50.584Z level=INFO run=b026c062 message="event stream connected" component=client role=cli
timestamp=2026-09-18T01:54:50.726Z level=INFO run=b026c062 message="event stream disconnected" component=client attempt=2 error=Transport role=cli
timestamp=2026-09-18T01:54:50.474Z level=INFO run=9fc2b9a5 message="server resolution failed" component=client attempt=93 error="Server process exited with code 130" role=cli
timestamp=2026-09-18T01:54:50.878Z level=INFO run=c59cfdd6 message="server resolution failed" component=client attempt=93 error="Server process exited with code 130" role=cli
Full log also shows multiple concurrent serve --service contenders starting/stopping (watcher stopped, InterruptError: All fibers interrupted on /api/event).
Example 3 — service recovers afterwards, plus broken plugins
$ opencode --version
opencode v2.0.7
$ opencode service status
http://127.0.0.1:49374
$ opencode api get /api/info
{"version":"2.0.7","pid":71261,"urls":["http://127.0.0.1:49374"],"paths":{"tmp":"/private/var/folders/.../T/opencode"}}
Server log shows 3 plugins failing to load on every boot (may contribute to instability):
WARN ... failed to load plugin target=/Users/.../.config/opencode/plugin/nineRemoteNotify.js cause="Plugin must export a default definition with an id and an effect or setup function. (cause: SchemaError(Missing key at [\"default\"]))"
WARN ... failed to load plugin target=/Users/.../.config/opencode/plugins/herdr-agent-state.js cause="... Missing key at [\"default\"]"
WARN ... failed to load plugin target=/Users/.../.config/opencode/plugins/open-island.js cause="... Expected object at [\"default\"]"
Plugins
nineRemoteNotify.js, herdr-agent-state.js, open-island.js, vibe-island.js, ultra/ (see log above — 3 fail validation). Reproduces even with those present; have not yet re-tested with --standalone / empty plugin dir.
OpenCode version
opencode v2.0.7 (channel=latest, Bun build)
Steps to reproduce
opencode --version->2.0.7opencode service stop(clean state)opencode(no args) in~on macOS- Observe
Starting background server...thenUnknownError ... Transport ... Unable to connectimmediately, instead of TUI tail -f ~/.local/share/opencode/log/opencode.logshowsevent stream disconnected error=Transport+server resolution failed ... exited with code 130loop- Retry later:
opencode service status+opencode api get /api/infosucceed — transient
Screenshot and/or share link
N/A — terminal + log excerpts above. Can provide full redacted opencode.log slice on request.
Operating System
macOS 26 / Darwin 25.2.0 ARM64 (MacBook Air, Darwin ... RELEASE_ARM64_T8112 arm64)
Terminal
Terminal.app via OpenCode session (default zsh); also reproduces from plain /bin/zsh -c "opencode"
Why a new issue (not a dup)
Checked #41696 (port 49374 conflict, fixed by #41793, remaining contender-overlap gap), #41746 (Windows port reservation, same hang symptom), #49034 / #49209 (timeout waiting for service). This report differs:
- No
Timed out waiting...message — immediateUnknownErrorinTui.runviaEffect.tryPromise. - Exit code is
130(SIGINT), not1/ EADDRINUSE, andlsofshows nothing on 49374 afterwards; service later binds fine. - Suggests a separate race: TUI event-stream connects before contender wins, or contender killed mid-handshake.
Suggested improvement (same theme as #41746 discussion): retain last contender stderr / resolution failure as cause on the TUI error instead of bare Transport / Unable to connect, so port in use vs crashed starting vs killed are distinguishable.
Per https://opencode.ai/v2/docs/troubleshooting reporting checklist: version + service status + repro + client vs shared-service scope + redacted logs included. No API keys included.
Activity
github-actions commentedon Sep 18, 2026
This issue might be a duplicate of existing issues. Please check:
UnknownError: An error occurred in Effect.tryPromise/ClientError: Transport/Unable to connectinTui.runduring a service contender race on macOS arm64. That issue also identifies the reconnect budget exhaustion and leaked contender processes as root causes.Your report differs in the specific trigger (exit code 130 / SIGINT rather than a version-mismatch bounce) and the immediate failure vs. timeout, so it may still represent a distinct edge case worth tracking separately. The maintainers can decide whether to merge.
sharno commentedon Sep 18, 2026
have the exact same issue on nixos
I had to get out of all my sessions in all tabs and then resume them back after starting the server.
huydhoang commentedon Sep 25, 2026
I got exactly the same issue on Windows - oc v2.0.16
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report and logs. I tried to reproduce this on
opencode v2.0.7(@opencode/[email protected]) on Linux:opencode service stop, fresh home directory), plainopencodestarted the background server and reached the TUI every time.Server process exited with code 130was by stopping the service myself while it was still starting (opencode service stopabout 0.2 s after launchingopencode). Then the client exits withError: Server process exited with code 130, not theUnknownError/Transport/Unable to connectyou saw inTui.run. Stopping it after the TUI had connected only caused a reconnect.So code 130 probably means the starting
serve --serviceprocess was interrupted (SIGINT) by something. These would help narrow it down:opencodein a plain Terminal.app window, rather than from inside another OpenCode session or its shell tool? Your log shows other runs (9fc2b9a5,c59cfdd6) at attempt 93 at the same moment. Were otheropencodeclients or scripts running then?~/.config/opencode/plugin(s)?opencode.loglines for one failing run, fromcli startingto the error. Please include theserve --serviceruns and any line that mentions a stop or an interrupt.bun add -g @opencode/cli@latest)?Related: #41696 (hidden startup failures of the background server), #41746 and #49034 (stuck at "Starting background server..." / timeouts).
opencodejr commentedon Oct 31, 2026
We haven't heard back, so I'm closing this as not planned for now. On
opencode v2.0.7, plainopencodereached the TUI every time, including with broken plugins and with several clients started at once. The onlyexited with code 130I saw came from stopping the background server myself while it was starting, and that gives a different error than theUnknownError/Transportone you reported.If it still happens, especially on the latest release (
bun add -g @opencode/cli@latest), please reply with:opencode.loglines for one failing runThen we can reopen and take another look. Related: #41696, #41746, #49034. Thanks for the detailed report!