server: a port that cannot be bound stops startup (closes #266) #275

Merged
clawbot merged 1 commits from fix/266-listen-failure-exits into next 2026-10-13 18:00:01 +02:00
1 Commits
Author SHA1 Message Date
clawbot af4fe4d1b7 server: a port that cannot be bound stops startup (closes #266)
check / check (push) Waiting to run
The start hook now binds the listen port itself and serves on it in a
goroutine. A bind failure, such as a port already in use or a
privileged port without root, is returned to fx, which stops startup
and exits 1 with an error like "starting http server: listen tcp
:8080: bind: address already in use". Before, the bind happened inside
the goroutine and its error was only logged while the watcher kept
running without the dashboard, API or health check.

The http.Server is now built before that goroutine starts, so Shutdown
no longer reads a field another goroutine may still be writing.

TestPortInUseStopsStartup holds a port and checks that starting the
server on it fails with an error naming it.

Model: opus-5-5
2026-10-13 14:27:47 +00:00