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
opencode serve shows "Unexpected error" with no details when startup fails #48784
When opencode serve fails to start (e.g. port conflict, missing config), the error output is:
Error: Unexpected error
ServeError
No actionable information is shown — no indication of what went wrong (port in use, missing config, permission error, etc.).
The root cause is in packages/opencode/src/index.ts lines 128-134: the catch block calls FormatError(e) which returns undefined for server startup errors (no matching _tag), then falls through to the generic "Unexpected error" + errorMessage(e). The Effect error from Server.listen likely has a structured cause that errorMessage() can't extract a useful string from — it just prints the _tag ("ServeError") with no underlying message.
OpenCode version
v1.18.29
Steps to reproduce
Run opencode serve --port 4096 --hostname 0.0.0.0 on a port that's already in use (or from a directory where startup fails)
Observe the error output — only "Unexpected error" and "ServeError" are shown
Expected: the actual reason for the failure (e.g. "EADDRINUSE: port 4096 already in use" or the specific config error)
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
github-actions commentedon Sep 13, 2026
This issue might be a duplicate of existing issues. Please check:
opencode serve: bind failures print bare "Unexpected error / ServeError" — the listen errno is never surfaced (identical root cause analysis and error output, with a proposed fix)opencode servefails immediately with generic 'ServeError' on Windows, no stack trace even at DEBUG level (same "Unexpected error / ServeError" output)thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊