Skip to content

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

Closed as not planned

Description

@marwan562

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.

Activity

  1. github-actions commented on Sep 18, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    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.

  2. sharno commented on Sep 18, 2026

    @sharno

    have the exact same issue on nixos

    sharno@sharno-desktop ~/dotfiles (main) [1]> opencode
    Starting background server...
    [23:32:56.931] ERROR (#1): UnknownError: An error occurred in Effect.tryPromise
        at <anonymous> (/$bunfs/root/chunk-y98gd495.js:24:5598)
        at ~effect/Utils/internal (/$bunfs/root/chunk-y98gd495.js:8:1540)
        at s (/$bunfs/root/chunk-y98gd495.js:24:5696)
        at processTicksAndRejections (native:7:39)
        at Tui.run (/$bunfs/root/chunk-3vv35md2.js:98:247)
        at Tui.run (definition) (/$bunfs/root/chunk-3vv35md2.js:93:17047) {
      [cause]: ClientError: Transport
          at <anonymous> (/$bunfs/root/chunk-dkdmw1vz.js:2:817)
          at async <anonymous> (/$bunfs/root/chunk-dkdmw1vz.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-dkdmw1vz.js:2:781)
            at async <anonymous> (/$bunfs/root/chunk-dkdmw1vz.js:2:1038)
      }
    }
    

    I had to get out of all my sessions in all tabs and then resume them back after starting the server.

  3. huydhoang commented on Sep 25, 2026

    @huydhoang

    I got exactly the same issue on Windows - oc v2.0.16

  4. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report and logs. I tried to reproduce this on opencode v2.0.7 (@opencode/[email protected]) on Linux:

    • From a clean state (opencode service stop, fresh home directory), plain opencode started the background server and reached the TUI every time.
    • I added plugins that fail the same "default export" check as yours and started 4 clients at once, several times. All of them reached the TUI.
    • The only way I got Server process exited with code 130 was by stopping the service myself while it was still starting (opencode service stop about 0.2 s after launching opencode). Then the client exits with Error: Server process exited with code 130, not the UnknownError / Transport / Unable to connect you saw in Tui.run. Stopping it after the TUI had connected only caused a reconnect.

    So code 130 probably means the starting serve --service process was interrupted (SIGINT) by something. These would help narrow it down:

    1. Does it happen when you run opencode in 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 other opencode clients or scripts running then?
    2. Does it still happen with your plugins moved out of ~/.config/opencode/plugin(s)?
    3. The full redacted opencode.log lines for one failing run, from cli starting to the error. Please include the serve --service runs and any line that mentions a stop or an interrupt.
    4. Does it still happen on the latest release (bun add -g @opencode/cli@latest)?

    Related: #41696 (hidden startup failures of the background server), #41746 and #49034 (stuck at "Starting background server..." / timeouts).

  5. opencodejr commented on Oct 31, 2026

    @opencodejr
    Contributor

    We haven't heard back, so I'm closing this as not planned for now. On opencode v2.0.7, plain opencode reached the TUI every time, including with broken plugins and with several clients started at once. The only exited with code 130 I saw came from stopping the background server myself while it was starting, and that gives a different error than the UnknownError / Transport one you reported.

    If it still happens, especially on the latest release (bun add -g @opencode/cli@latest), please reply with:

    • whether it happens in a plain Terminal.app window, outside another OpenCode session
    • whether it happens with your plugins moved out
    • the redacted opencode.log lines for one failing run

    Then we can reopen and take another look. Related: #41696, #41746, #49034. Thanks for the detailed report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions