{"record":{"id":"53760cf7275ed4da","repo":"nats-io/nats-server","slug":"invalid-clientadvertise-value-of-s-err-v","errorCode":null,"errorMessage":"invalid ClientAdvertise value of %s, err=%v","messagePattern":"invalid ClientAdvertise value of (.+?), err=(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/reload.go","lineNumber":1740,"sourceCode":"\t\t\tdiffOpts = append(diffOpts, &pidFileOption{newValue: newValue.(string)})\n\t\tcase \"portsfiledir\":\n\t\t\tdiffOpts = append(diffOpts, &portsFileDirOption{newValue: newValue.(string), oldValue: oldValue.(string)})\n\t\tcase \"maxcontrolline\":\n\t\t\tdiffOpts = append(diffOpts, &maxControlLineOption{newValue: newValue.(int32)})\n\t\tcase \"maxpayload\":\n\t\t\tdiffOpts = append(diffOpts, &maxPayloadOption{newValue: newValue.(int32)})\n\t\tcase \"pinginterval\":\n\t\t\tdiffOpts = append(diffOpts, &pingIntervalOption{newValue: newValue.(time.Duration)})\n\t\tcase \"maxpingsout\":\n\t\t\tdiffOpts = append(diffOpts, &maxPingsOutOption{newValue: newValue.(int)})\n\t\tcase \"writedeadline\":\n\t\t\tdiffOpts = append(diffOpts, &writeDeadlineOption{newValue: newValue.(time.Duration)})\n\t\tcase \"clientadvertise\":\n\t\t\tcliAdv := newValue.(string)\n\t\t\tif cliAdv != \"\" {\n\t\t\t\t// Validate ClientAdvertise syntax\n\t\t\t\tif _, _, err := parseHostPort(cliAdv, 0); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"invalid ClientAdvertise value of %s, err=%v\", cliAdv, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tdiffOpts = append(diffOpts, &clientAdvertiseOption{newValue: cliAdv})\n\t\tcase \"accounts\":\n\t\t\tdiffOpts = append(diffOpts, &accountsOption{})\n\t\tcase \"resolver\", \"accountresolver\", \"accountsresolver\":\n\t\t\t// We can't move from no resolver to one. So check for that.\n\t\t\tif (oldValue == nil && newValue != nil) ||\n\t\t\t\t(oldValue != nil && newValue == nil) {\n\t\t\t\treturn nil, fmt.Errorf(\"config reload does not support moving to or from an account resolver\")\n\t\t\t}\n\t\t\tdiffOpts = append(diffOpts, &accountsOption{})\n\t\tcase \"accountresolvertlsconfig\":\n\t\t\tdiffOpts = append(diffOpts, &accountsOption{})\n\t\tcase \"gateway\":\n\t\t\t// Not supported for now, but report warning if configuration of gateway\n\t\t\t// is actually changed so that user knows that it won't take effect.\n","sourceCodeStart":1722,"sourceCodeEnd":1758,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/reload.go#L1722-L1758","documentation":"During reload of the client_advertise option, the new string is validated with parseHostPort. An empty value is allowed, but a non-empty value that is not a valid host[:port] makes reload fail with this error.","triggerScenarios":"Setting client_advertise in the config (or via option reload) to a malformed value like 'my host:99999', 'http://x', or 'host:port:extra' and issuing a reload.","commonSituations":"Typos in client_advertise (spaces, scheme prefix, invalid port), YAML quoting issues leaving stray whitespace, or IPv6 literals without brackets.","solutions":["Correct client_advertise to a valid host or host:port (e.g. 'advertise.example.com:4222' or '[::1]:4222').","Remove the scheme (no 'nats://' or 'http://') and quotes/whitespace from the value.","Set client_advertise to empty string (\"\") if you intend to disable advertising, rather than an invalid placeholder."],"exampleFix":"// before\nclient_advertise: \"http://node1:4222\"\n// after\nclient_advertise: \"node1.example.com:4222\"","handlingStrategy":"validation","validationCode":"if cliAdv != \"\" {\n    if _, _, err := parseHostPort(cliAdv, 0); err != nil {\n        return fmt.Errorf(\"invalid client_advertise %q: %v\", cliAdv, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := srv.Reload(); err != nil {\n    if strings.Contains(err.Error(), \"invalid ClientAdvertise\") {\n        log.Printf(\"fix client_advertise and reload again: %v\", err)\n    }\n}","preventionTips":["Use host or host:port only — no scheme, spaces, or extra colons.","Bracket IPv6 literals: [::1]:4222.","Lint config values with a host:port regex before reload."],"tags":["reload","configuration","validation"],"backgroundTag":"invalid-host-port","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}