thanos-io/thanos · error
serve HTTP and metrics
Error message
serve HTTP and metrics
What it means
Raised in http.Server.ListenAndServe as the return of toolkit_web.ListenAndServe: after successful config validation, serving HTTP and metrics failed — bind failure on the listen address, or a runtime error from the toolkit web server (TLS handshake config issues, listener closed).
Solutions
- Check the --web listen address is free and bindable
- Inspect the wrapped error for TLS or listener failures
- Verify systemd socket activation settings match the configuration
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/server/http/http.go:83 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/08735a13f004ceb3.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/server/http/http.go:83
opts: options,
}
}
// ListenAndServe listens on the TCP network address and handles requests on incoming connections.
func (s *Server) ListenAndServe() error {
level.Info(s.logger).Log("msg", "listening for requests and metrics", "address", s.opts.listen)
err := toolkit_web.Validate(s.opts.tlsConfigPath)
if err != nil {
return errors.Wrap(err, "server could not be started")
}
flags := &toolkit_web.FlagConfig{
WebListenAddresses: &([]string{s.opts.listen}),
WebSystemdSocket: ofBool(false),
WebConfigFile: &s.opts.tlsConfigPath,
}
return errors.Wrap(toolkit_web.ListenAndServe(s.srv, flags, logutil.GoKitLogToSlog(s.logger)), "serve HTTP and metrics")
}
// Shutdown gracefully shuts down the server by waiting,
// for specified amount of time (by gracePeriod) for connections to return to idle and then shut down.
func (s *Server) Shutdown(err error) {
level.Info(s.logger).Log("msg", "internal server is shutting down", "err", err)
if err == http.ErrServerClosed {
level.Warn(s.logger).Log("msg", "internal server closed unexpectedly")
return
}
if s.opts.gracePeriod == 0 {
s.srv.Close()
level.Info(s.logger).Log("msg", "internal server is shutdown", "err", err)
return
}
ctx, cancel := context.WithTimeout(context.Background(), s.opts.gracePeriod)View on GitHub (pinned to 35b8b99117)