{"record":{"id":"7dfa21896ff642e4","repo":"nats-io/nats-server","slug":"expected-cluster-password-to-be-set","errorCode":null,"errorMessage":"expected cluster password to be set","messagePattern":"expected cluster password to be set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/opts.go","lineNumber":6546,"sourceCode":"\t\treturn err\n\t}\n\th, p, err := net.SplitHostPort(clusterURL.Host)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif wantsRandom {\n\t\tp = \"-1\"\n\t}\n\topts.Cluster.Host = h\n\t_, err = fmt.Sscan(p, &opts.Cluster.Port)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif clusterURL.User != nil {\n\t\tpass, hasPassword := clusterURL.User.Password()\n\t\tif !hasPassword {\n\t\t\treturn errors.New(\"expected cluster password to be set\")\n\t\t}\n\t\topts.Cluster.Password = pass\n\n\t\tuser := clusterURL.User.Username()\n\t\topts.Cluster.Username = user\n\t} else {\n\t\t// Since we override from flag and there is no user/pwd, make\n\t\t// sure we clear what we may have gotten from config file.\n\t\topts.Cluster.Username = _EMPTY_\n\t\topts.Cluster.Password = _EMPTY_\n\t}\n\n\treturn nil\n}\n\nfunc processSignal(signal string) error {\n\tvar (\n\t\tpid           string","sourceCodeStart":6528,"sourceCodeEnd":6564,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/opts.go#L6528-L6564","documentation":"Parsing a cluster URL from options: the URL carries a username but no password component (clusterURL.User.Password() returned false), and cluster auth requires both or neither. The userinfo portion of the cluster:// URL is the input at fault.","triggerScenarios":"Thrown at server/opts.go:6546 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the password to the URL: cluster://user:pass@host:port","Remove the userinfo entirely if cluster auth is not used","Check for URL-encoding mistakes that drop or mangle the password"],"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"}