Skip to content

feat(server): improve server startup error handling#1224

Closed
braden-w wants to merge 1 commit into
anomalyco:devfrom
EpicenterHQ:feat/server-error-handling
Closed

feat(server): improve server startup error handling#1224
braden-w wants to merge 1 commit into
anomalyco:devfrom
EpicenterHQ:feat/server-error-handling

Conversation

@braden-w

@braden-w braden-w commented Jul 22, 2025

Copy link
Copy Markdown

Previously, when users ran the opencode serve command and the default port 4096 was already in use, they would see an unexpected error message:

Error: Unexpected error, check log file at ~/.local/share/opencode/log/dev.log for more details
error: script "dev" exited with code 1

The implementation wraps Bun.serve() calls in try-catch blocks and maps them into ServerStartError errors using the established NamedError pattern. The original Bun error message (like "Failed to start server. Is port 4096 in use?") is preserved and displayed directly to users via the FormatError system.

Add structured error handling for server startup failures:
- Catch Bun.serve() errors and wrap in ServerStartError NamedError
- Pass through original Bun error messages (e.g., "Failed to start server. Is port 4096 in use?")
- Format errors in FormatError() to display user-friendly messages
- Prevents generic "unexpected error" messages for common server startup issues
teamgroove pushed a commit to teamgroove/opencode that referenced this pull request Aug 3, 2025
…andling

Merged from: anomalyco#1224
Author: @braden-w
Auto-merged by opencode-fork integration system
@github-actions
github-actions Bot force-pushed the dev branch 3 times, most recently from f1dc981 to 3e15a39 Compare November 22, 2025 18:07
@github-actions
github-actions Bot force-pushed the dev branch 3 times, most recently from f8ee907 to 6a9856d Compare November 27, 2025 01:29
@github-actions github-actions Bot closed this Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant