thanos-io/thanos · error

server could not be started

Error message

server could not be started

What it means

Raised in http.Server.ListenAndServe when toolkit_web.Validate of the TLS/web config file fails before the HTTP/metrics server starts — i.e., the --web.config.file TLS configuration is missing, unreadable, or invalid, so the server refuses to start.

Solutions

  1. Fix syntax or content errors in the web/TLS config file
  2. Ensure the config file path exists and is readable by the process
  3. Validate the config with the promtool/web toolkit before deploying
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/server/http/http.go:74 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/880dd1c8cb702204. Report an issue: GitHub.

Appendix: source

Thrown at pkg/server/http/http.go:74

		protocols.SetUnencryptedHTTP2(true)
		srv.Protocols = protocols
	}

	return &Server{
		logger: log.With(logger, "service", "http/server", "component", comp.String()),
		comp:   comp,
		mux:    mux,
		srv:    srv,
		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

View on GitHub (pinned to 35b8b99117)