opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(server): improve server startup error handling

Open braden-w opened this issue 5 months ago • 0 comments

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.

braden-w avatar Jul 22 '25 17:07 braden-w