{"record":{"id":"7a5baa940fe65df8","repo":"nats-io/nats-server","slug":"invalid-cluster-advertise-value-of-s-err-v","errorCode":null,"errorMessage":"invalid Cluster.Advertise value of %s, err=%v","messagePattern":"invalid Cluster\\.Advertise value of (.+?), err=(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/reload.go","lineNumber":2793,"sourceCode":"\t}\n\ts.mu.Unlock()\n}\n\n// validateClusterOpts ensures the new ClusterOpts does not change some of the\n// fields that do not support reload.\nfunc validateClusterOpts(old, new ClusterOpts) error {\n\tif old.Host != new.Host {\n\t\treturn fmt.Errorf(\"config reload not supported for cluster host: old=%s, new=%s\",\n\t\t\told.Host, new.Host)\n\t}\n\tif old.Port != new.Port {\n\t\treturn fmt.Errorf(\"config reload not supported for cluster port: old=%d, new=%d\",\n\t\t\told.Port, new.Port)\n\t}\n\t// Validate Cluster.Advertise syntax\n\tif new.Advertise != \"\" {\n\t\tif _, _, err := parseHostPort(new.Advertise, 0); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid Cluster.Advertise value of %s, err=%v\", new.Advertise, err)\n\t\t}\n\t}\n\treturn nil\n}\n\n// diffRoutes diffs the old routes and the new routes and returns the ones that\n// should be added and removed from the server.\nfunc diffRoutes(old, new []*url.URL) (add, remove []*url.URL) {\n\t// Find routes to remove.\nremoveLoop:\n\tfor _, oldRoute := range old {\n\t\tfor _, newRoute := range new {\n\t\t\tif urlsAreEqual(oldRoute, newRoute) {\n\t\t\t\tcontinue removeLoop\n\t\t\t}\n\t\t}\n\t\tremove = append(remove, oldRoute)\n\t}","sourceCodeStart":2775,"sourceCodeEnd":2811,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/reload.go#L2775-L2811","documentation":"During a config reload, validateClusterOpts parses the new cluster.advertise string with parseHostPort(advertise, 0) and fails when it is not a valid host[:port]. This is a syntax check on the operator-supplied advertise string (bad hostname characters, malformed port, etc.), surfaced with the underlying parse error (%v).","triggerScenarios":"Thrown at server/reload.go:2793 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct cluster.advertise to a valid host or host:port string (e.g. 'nats.example.com:6222')","Remove cluster.advertise if the real client/host address should be used","Check for stray whitespace, scheme prefixes (http://) or non-numeric ports in the value"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}