{"record":{"id":"bbf5261467d3755c","repo":"thanos-io/thanos","slug":"serve-grpc","errorCode":null,"errorMessage":"serve gRPC","messagePattern":"serve gRPC","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/server/grpc/grpc.go","lineNumber":163,"sourceCode":"\n\treturn &Server{\n\t\tlogger: logger,\n\t\tcomp:   comp,\n\t\tsrv:    s,\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\tl, err := net.Listen(s.opts.network, s.opts.listen)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"listen gRPC on address %s\", s.opts.listen)\n\t}\n\ts.listener = l\n\n\tlevel.Info(s.logger).Log(\"msg\", \"listening for serving gRPC\", \"address\", s.opts.listen)\n\treturn errors.Wrap(s.srv.Serve(s.listener), \"serve gRPC\")\n}\n\nfunc (s *Server) Address() string {\n\tif s.listener != nil {\n\t\treturn s.listener.Addr().String()\n\t}\n\treturn \"\"\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\n\tif s.opts.gracePeriod == 0 {\n\t\ts.srv.Stop()\n\t\tlevel.Info(s.logger).Log(\"msg\", \"internal server is shutdown\", \"err\", err)\n\t\treturn","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/server/grpc/grpc.go#L145-L181","documentation":"Raised in grpc.Server.ListenAndServe when grpc.Server.Serve(l) returns after the listener was successfully bound — i.e., serving failed or stopped with an error (listener closed unexpectedly, accept failure, TLS setup error). Startup is considered failed and the error is propagated to the caller.","triggerScenarios":"Thrown at pkg/server/grpc/grpc.go:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped Serve error for accept or TLS handshake failures","Check for processes interfering with the bound listener","Review gRPC server options (credentials, TLS config) for validity"],"exampleFix":null,"handlingStrategy":"try-catch","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"}