crowdsecurity/crowdsec · error
http server failed: %w
Error message
http server failed: %w
What it means
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.
Source
Thrown at pkg/acquisition/modules/http/run.go:258
}
s.logger.Infof("creating unix socket on %s", s.Config.ListenSocket)
_ = os.Remove(s.Config.ListenSocket)
listener, err := listenConfig.Listen(ctx, "unix", s.Config.ListenSocket)
if err != nil {
return csnet.WrapSockErr(err, s.Config.ListenSocket)
}
if s.Config.TLS != nil {
err := s.Server.ServeTLS(listener, s.Config.TLS.ServerCert, s.Config.TLS.ServerKey)
if err != nil && err != http.ErrServerClosed {
return fmt.Errorf("https server failed: %w", err)
}
} else {
err := s.Server.Serve(listener)
if err != nil && err != http.ErrServerClosed {
return fmt.Errorf("http server failed: %w", err)
}
}
return nil
})
t.Go(func() error {
defer trace.ReportPanic()
if s.Config.ListenAddr == "" {
return nil
}
if s.Config.TLS != nil {
s.logger.Infof("start https server on %s", s.Config.ListenAddr)
err := s.Server.ListenAndServeTLS(s.Config.TLS.ServerCert, s.Config.TLS.ServerKey)
if err != nil && err != http.ErrServerClosed {View on GitHub (pinned to 909b515798)
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).
Defensive patterns
Strategy: try-catch
Validate before calling
if _, err := net.Listen("unix", sockPath); err != nil { return err } // probe bindability first Try / catch
if err := serve(); err != nil && !errors.Is(err, http.ErrServerClosed) { log.Errorf("http server: %v", err) } Prevention
- Ensure nothing deletes the socket file at runtime.
- Use stable socket paths with correct ownership.
- Avoid running duplicate instances on the same socket.
When it happens
Trigger: 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.
Common situations: Another process or cleanup job deleted/unlinked the socket file at the configured path; supervisor signals causing double-close; file descriptor exhaustion.
Related errors
- https server failed: %w
- while closing %s server: %w
- path must start with /
- chunk_size must be positive
- invalid HTTP status code
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/3761b5a25db7d653.
Report an issue: GitHub.