{"record":{"id":"3761b5a25db7d653","repo":"crowdsecurity/crowdsec","slug":"http-server-failed-w","errorCode":null,"errorMessage":"http server failed: %w","messagePattern":"http server failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/http/run.go","lineNumber":258,"sourceCode":"\t\t}\n\n\t\ts.logger.Infof(\"creating unix socket on %s\", s.Config.ListenSocket)\n\t\t_ = os.Remove(s.Config.ListenSocket)\n\n\t\tlistener, err := listenConfig.Listen(ctx, \"unix\", s.Config.ListenSocket)\n\t\tif err != nil {\n\t\t\treturn csnet.WrapSockErr(err, s.Config.ListenSocket)\n\t\t}\n\n\t\tif s.Config.TLS != nil {\n\t\t\terr := s.Server.ServeTLS(listener, s.Config.TLS.ServerCert, s.Config.TLS.ServerKey)\n\t\t\tif err != nil && err != http.ErrServerClosed {\n\t\t\t\treturn fmt.Errorf(\"https server failed: %w\", err)\n\t\t\t}\n\t\t} else {\n\t\t\terr := s.Server.Serve(listener)\n\t\t\tif err != nil && err != http.ErrServerClosed {\n\t\t\t\treturn fmt.Errorf(\"http server failed: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tt.Go(func() error {\n\t\tdefer trace.ReportPanic()\n\n\t\tif s.Config.ListenAddr == \"\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tif s.Config.TLS != nil {\n\t\t\ts.logger.Infof(\"start https server on %s\", s.Config.ListenAddr)\n\n\t\t\terr := s.Server.ListenAndServeTLS(s.Config.TLS.ServerCert, s.Config.TLS.ServerKey)\n\t\t\tif err != nil && err != http.ErrServerClosed {","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/http/run.go#L240-L276","documentation":"The non-TLS counterpart of the socket-based serve path: http.Server.Serve on the unix socket listener failed with something other than the expected graceful-shutdown sentinel, so the acquisition goroutine returns this error.","triggerScenarios":"Datasource without a TLS block using listen_socket; Serve returns a non-ErrServerClosed error, e.g. the socket file was removed mid-run, permission issues, or listener closed unexpectedly.","commonSituations":"Another process or cleanup job deleted/unlinked the socket file at the configured path; supervisor signals causing double-close; file descriptor exhaustion.","solutions":["Confirm the listen_socket path still exists and has correct permissions while the service runs.","Check for conflicting processes bound to the same socket; restart the service cleanly.","Inspect the wrapped inner error to distinguish socket close vs accept failure.","Ensure only one crowdsec instance uses that socket (address-already-in-use style conflicts)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, err := net.Listen(\"unix\", sockPath); err != nil { return err } // probe bindability first","typeGuard":null,"tryCatchPattern":"if err := serve(); err != nil && !errors.Is(err, http.ErrServerClosed) { log.Errorf(\"http server: %v\", err) }","preventionTips":["Ensure nothing deletes the socket file at runtime.","Use stable socket paths with correct ownership.","Avoid running duplicate instances on the same socket."],"tags":["http","server","socket"],"backgroundTag":"address-already-in-use","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}