{"record":{"id":"2943058ef449a582","repo":"nats-io/nats-server","slug":"remote-leaf-node-configuration-cannot-have-a-mix-o","errorCode":null,"errorMessage":"remote leaf node configuration cannot have a mix of websocket and non-websocket urls: %q","messagePattern":"remote leaf node configuration cannot have a mix of websocket and non-websocket urls: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/leafnode.go","lineNumber":310,"sourceCode":"\n\t// If a remote has a websocket scheme, all need to have it.\n\tfor _, rcfg := range o.LeafNode.Remotes {\n\t\t// Validate proxy configuration\n\t\tif _, err := validateLeafNodeProxyOptions(rcfg); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(rcfg.URLs) >= 2 {\n\t\t\tfirstIsWS, ok := isWSURL(rcfg.URLs[0]), true\n\t\t\tfor i := 1; i < len(rcfg.URLs); i++ {\n\t\t\t\tu := rcfg.URLs[i]\n\t\t\t\tif isWS := isWSURL(u); isWS && !firstIsWS || !isWS && firstIsWS {\n\t\t\t\t\tok = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"remote leaf node configuration cannot have a mix of websocket and non-websocket urls: %q\", redactURLList(rcfg.URLs))\n\t\t\t}\n\t\t}\n\t\tif !wsAllowedFIPS() {\n\t\t\tfor _, u := range rcfg.URLs {\n\t\t\t\tif isWSURL(u) {\n\t\t\t\t\treturn fmt.Errorf(\"remote leaf node URL %q cannot be used in FIPS-140 mode when built with this Go version, use Go 1.26 or later\", redactURLString(u.String()))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Validate compression settings\n\t\tif rcfg.Compression.Mode != _EMPTY_ {\n\t\t\tif err := validateAndNormalizeCompressionOption(&rcfg.Compression, CompressionS2Auto); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.LeafNode.Port == 0 {","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/leafnode.go#L292-L328","documentation":"Leafnode remote validation: within a single remote's URL list, some URLs use the ws/wss scheme and others do not; a leaf connection must be uniformly websocket or plain TCP across the failover list.","triggerScenarios":"Thrown at server/leafnode.go:310 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Split websocket and non-websocket URLs into separate remotes","Convert all URLs in the list to ws:// or wss://","Remove mismatched URLs from the remote"],"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-08T10:18:20.063Z"}