navidrome/navidrome · error
running server: %w
Error message
running server: %w
What it means
After successful startup, Run() blocks on errC; if the background goroutine sends an error while the server is running (Serve() returned unexpectedly), it is wrapped with 'running server'. This means the HTTP server crashed mid-operation rather than at boot.
Source
Thrown at server/server.go:129
}
}()
// Measure server startup time
startupTime := time.Since(consts.ServerStart)
// Wait a short time to make sure the server has started successfully
select {
case err := <-errC:
log.Error(ctx, "Could not start server. Aborting", err)
return fmt.Errorf("starting server: %w", err)
case <-time.After(50 * time.Millisecond):
log.Info(ctx, "----> Navidrome server is ready!", "address", addr, "startupTime", startupTime, "tlsEnabled", tlsEnabled)
}
// Wait for a signal to terminate
select {
case err := <-errC:
return fmt.Errorf("running server: %w", err)
case <-ctx.Done():
// If the context is done (i.e. the server should stop), proceed to shutting down the server
}
// Try to stop the HTTP server gracefully
log.Info(ctx, "Stopping HTTP server")
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
server.SetKeepAlivesEnabled(false)
if err := server.Shutdown(ctx); err != nil && !errors.Is(err, context.DeadlineExceeded) {
log.Error(ctx, "Unexpected error in http.Shutdown()", err)
}
return nil
}
func createUnixSocketFile(socketPath string, socketPerm string) (net.Listener, error) {
// Remove the socket file if it already exists
if err := os.Remove(socketPath); err != nil && !os.IsNotExist(err) {View on GitHub (pinned to 4ed7494a32)
Solutions
- Inspect the wrapped cause in logs and fix the underlying listener/network condition
- Restart the service (systemd restart navidrome) or run it under a supervisor with automatic restart
- Check dmesg/system logs for network device or resource (fd/memory) errors
- Verify stable networking in containerized deployments (host vs bridge networking)
Defensive patterns
Strategy: retry
Try / catch
err := srv.Run(ctx)
if err != nil && strings.HasPrefix(err.Error(), "running server") {
log.Errorf("server stopped unexpectedly: %v — restarting under supervisor", err)
// systemd Restart=on-failure handles this automatically
} Prevention
- Configure systemd Restart=on-failure or a container restart policy
- Monitor network interface health on long-running NAS devices
- Watch file-descriptor and memory limits to avoid accept failures
- Alert on process exit so the crash is noticed
When it happens
Trigger: http.Server.Serve() returns a non-ErrServerClosed error while running — e.g. listener I/O failure, accept errors beyond limits, abrupt network device removal.
Common situations: Network interface going down on a NAS; firewall/conntrack issues killing the listening socket; container runtime networking failures; resource exhaustion causing accept errors.
Related errors
AI-assisted analysis of navidrome/navidrome@4ed7494a32 (2026-09-01).
Data as JSON: /api/errors/536147e9a862fe58.
Report an issue: GitHub.