anomalyco / anomalyco/opencode

v2.0.7: opencode fails at Starting background server with UnknownError Transport Unable to connect (exit 130)

Open
#49,658 2 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Sep 18, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

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
  1. opencode --version -> 2.0.7
  2. opencode service stop (clean state)
  3. opencode (no args) in ~ on macOS
  4. Observe Starting background server... then UnknownError ... Transport ... Unable to connect immediately, instead of TUI
  5. tail -f ~/.local/share/opencode/log/opencode.log shows event stream disconnected error=Transport + server resolution failed ... exited with code 130 loop
  6. Retry later: opencode service status + opencode api get /api/info succeed — 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 — immediate UnknownError in Tui.run via Effect.tryPromise.
  • Exit code is 130 (SIGINT), not 1 / EADDRINUSE, and lsof shows 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.