Summary
When the background service's default port (49374 on release channels) is unavailable, the TUI hangs on Starting background server... indefinitely instead of choosing another port or reporting the bind failure. On WSL2/Hyper-V this happens unpredictably because the host can reserve ranges covering that port.
Environment
- opencode v2.0.20, latest (binary at
/root/.opencode/bin/opencode)
- Linux 5.15 WSL2 (Windows host),
/bin/bash, TERM=xterm-256color
- Plugins:
-opencode-pty, cc-safety-net@latest; CLI plugins opencode-stats, ssh-remote, devices
Reproduction
- Make
49374 unbindable (another listener, or a WSL/Hyper-V dynamic port exclusion covering it).
- Run
opencode.
- The TUI stays on
Starting background server... and never reaches a session.
Expected Behavior
Bind a free port automatically, or fail fast with a visible error naming the port and the opencode service set port <port> remedy.
Actual Behavior
The child service emits the real error:
Managed service port ${port} on ${host} is already in use by another process.
Configure another port with `opencode service set port <port>` and start the service again.
…but the client captures that stderr, prints only Starting background server..., and retries with backoff (spawnDelay 5000, maxSpawnDelay 30000, promiseTimeout 120000).
Additional Context
Summary
When the background service's default port (
49374on release channels) is unavailable, the TUI hangs onStarting background server...indefinitely instead of choosing another port or reporting the bind failure. On WSL2/Hyper-V this happens unpredictably because the host can reserve ranges covering that port.Environment
/root/.opencode/bin/opencode)/bin/bash,TERM=xterm-256color-opencode-pty,cc-safety-net@latest; CLI pluginsopencode-stats,ssh-remote,devicesReproduction
49374unbindable (another listener, or a WSL/Hyper-V dynamic port exclusion covering it).opencode.Starting background server...and never reaches a session.Expected Behavior
Bind a free port automatically, or fail fast with a visible error naming the port and the
opencode service set port <port>remedy.Actual Behavior
The child service emits the real error:
…but the client captures that stderr, prints only
Starting background server..., and retries with backoff (spawnDelay 5000,maxSpawnDelay 30000,promiseTimeout 120000).Additional Context
49374,localreturns49375, others derive a value; there is no fallback or port scan.service setacceptsport, butservice set --helpomits it and the Network docs cover onlyservice set env.