nats-io/nats-server · error
config reload not supported for cluster port: old=%d, new=%d
Error message
config reload not supported for cluster port: old=%d, new=%d
What it means
validateClusterOpts blocks a config reload that changes cluster.port: the cluster route listener port is fixed at startup, so any diff between old and new port aborts the reload with both values shown. The server continues listening on the old port.
Source
Thrown at server/reload.go:2787
}
// Allow routes to be accepted now.
s.routesReject = false
// If there is a pool size change or added accounts, solicit routes now.
if co.poolSizeChanged || len(co.accsAdded) > 0 {
s.solicitRoutes(opts.Routes, co.accsAdded)
}
s.mu.Unlock()
}
// validateClusterOpts ensures the new ClusterOpts does not change some of the
// fields that do not support reload.
func validateClusterOpts(old, new ClusterOpts) error {
if old.Host != new.Host {
return fmt.Errorf("config reload not supported for cluster host: old=%s, new=%s",
old.Host, new.Host)
}
if old.Port != new.Port {
return fmt.Errorf("config reload not supported for cluster port: old=%d, new=%d",
old.Port, new.Port)
}
// Validate Cluster.Advertise syntax
if new.Advertise != "" {
if _, _, err := parseHostPort(new.Advertise, 0); err != nil {
return fmt.Errorf("invalid Cluster.Advertise value of %s, err=%v", new.Advertise, err)
}
}
return nil
}
// diffRoutes diffs the old routes and the new routes and returns the ones that
// should be added and removed from the server.
func diffRoutes(old, new []*url.URL) (add, remove []*url.URL) {
// Find routes to remove.
removeLoop:
for _, oldRoute := range old {
for _, newRoute := range new {View on GitHub (pinned to 3a66a489d2)
Solutions
- Keep cluster.port unchanged across reloads; revert the config edit
- Restart the server to apply a new cluster port
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/reload.go:2787 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/1df695fec2864233.
Report an issue: GitHub.