{"record":{"id":"880dd1c8cb702204","repo":"thanos-io/thanos","slug":"server-could-not-be-started","errorCode":null,"errorMessage":"server could not be started","messagePattern":"server could not be started","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/server/http/http.go","lineNumber":74,"sourceCode":"\t\tprotocols.SetUnencryptedHTTP2(true)\n\t\tsrv.Protocols = protocols\n\t}\n\n\treturn &Server{\n\t\tlogger: log.With(logger, \"service\", \"http/server\", \"component\", comp.String()),\n\t\tcomp:   comp,\n\t\tmux:    mux,\n\t\tsrv:    srv,\n\t\topts:   options,\n\t}\n}\n\n// ListenAndServe listens on the TCP network address and handles requests on incoming connections.\nfunc (s *Server) ListenAndServe() error {\n\tlevel.Info(s.logger).Log(\"msg\", \"listening for requests and metrics\", \"address\", s.opts.listen)\n\terr := toolkit_web.Validate(s.opts.tlsConfigPath)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"server could not be started\")\n\t}\n\n\tflags := &toolkit_web.FlagConfig{\n\t\tWebListenAddresses: &([]string{s.opts.listen}),\n\t\tWebSystemdSocket:   ofBool(false),\n\t\tWebConfigFile:      &s.opts.tlsConfigPath,\n\t}\n\n\treturn errors.Wrap(toolkit_web.ListenAndServe(s.srv, flags, logutil.GoKitLogToSlog(s.logger)), \"serve HTTP and metrics\")\n}\n\n// Shutdown gracefully shuts down the server by waiting,\n// for specified amount of time (by gracePeriod) for connections to return to idle and then shut down.\nfunc (s *Server) Shutdown(err error) {\n\tlevel.Info(s.logger).Log(\"msg\", \"internal server is shutting down\", \"err\", err)\n\tif err == http.ErrServerClosed {\n\t\tlevel.Warn(s.logger).Log(\"msg\", \"internal server closed unexpectedly\")\n\t\treturn","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/server/http/http.go#L56-L92","documentation":"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.","triggerScenarios":"Thrown at pkg/server/http/http.go:74 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix syntax or content errors in the web/TLS config file","Ensure the config file path exists and is readable by the process","Validate the config with the promtool/web toolkit before deploying"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}