{"record":{"id":"1313f5a6b98af9b4","repo":"nats-io/nats-server","slug":"leafnodes-disabled","errorCode":null,"errorMessage":"leafnodes disabled","messagePattern":"leafnodes disabled","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/errors.go","lineNumber":94,"sourceCode":"\tErrTooManySubs = errors.New(\"maximum subscriptions exceeded\")\n\n\t// ErrTooManySubTokens signals a client that the subject has too many tokens.\n\tErrTooManySubTokens = errors.New(\"subject has exceeded number of tokens limit\")\n\n\t// ErrClientConnectedToRoutePort represents an error condition when a client\n\t// attempted to connect to the route listen port.\n\tErrClientConnectedToRoutePort = errors.New(\"attempted to connect to route port\")\n\n\t// ErrClientConnectedToLeafNodePort represents an error condition when a client\n\t// attempted to connect to the leaf node listen port.\n\tErrClientConnectedToLeafNodePort = errors.New(\"attempted to connect to leaf node port\")\n\n\t// ErrLeafNodeHasSameClusterName represents an error condition when a leafnode is a cluster\n\t// and it has the same cluster name as the hub cluster.\n\tErrLeafNodeHasSameClusterName = errors.New(\"remote leafnode has same cluster name\")\n\n\t// ErrLeafNodeDisabled is when we disable leafnodes.\n\tErrLeafNodeDisabled = errors.New(\"leafnodes disabled\")\n\n\t// ErrConnectedToWrongPort represents an error condition when a connection is attempted\n\t// to the wrong listen port (for instance a LeafNode to a client port, etc...)\n\tErrConnectedToWrongPort = errors.New(\"attempted to connect to wrong port\")\n\n\t// ErrAccountExists is returned when an account is attempted to be registered\n\t// but already exists.\n\tErrAccountExists = errors.New(\"account exists\")\n\n\t// ErrBadAccount represents a malformed or incorrect account.\n\tErrBadAccount = errors.New(\"bad account\")\n\n\t// ErrReservedAccount represents a reserved account that can not be created.\n\tErrReservedAccount = errors.New(\"reserved account\")\n\n\t// ErrMissingAccount is returned when an account does not exist.\n\tErrMissingAccount = errors.New(\"account missing\")\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/errors.go#L76-L112","documentation":"ErrLeafNodeDisabled is returned by connectToRemoteLeafNode when the server's leaf-node outbound connections are disabled (s.isLeafConnectDisabled()). The server logs that it will not attempt to connect to the configured remote and aborts the solicitation with this error instead of dialing.","triggerScenarios":"Calling the leaf-node connect path (e.g. via server.Start or Reload triggering remote leaf solicitation) while the server option to disable leafnode connections is set (e.g. leafnodes disabled via config/option -noleaf or NoLeafNode style flag). Seen at leafnode.go:797.","commonSituations":"Operators hardening a server (edge node) with leaf connect disabled but leftover leafnodes remotes config; CI environments starting servers with disable flags; tests or tooling expecting leaf links that were disabled at startup.","solutions":["Remove the disable-leafnodes option/flag so the server may solicit remote leaf connections","Remove the leafnodes remotes entries from config if leaf links are genuinely unwanted","Restart/reload the server after changing the option"],"exampleFix":"// before\nsrv, _ := server.NewServer(opts)\nopts.NoLeafNode = true // connect disabled\n// after\nopts.NoLeafNode = false\nsrv, _ := server.NewServer(opts)\ngo srv.Start()","handlingStrategy":"validation","validationCode":"if serverDisabledLeafConnect(opts) && len(opts.LeafNode.Remotes) > 0 {\n    return fmt.Errorf(\"leaf remotes configured but leaf connections are disabled\")\n}","typeGuard":null,"tryCatchPattern":"if err := srv.ConnectRemotes(); err != nil && errors.Is(err, ErrLeafNodeDisabled) {\n    log.Printf(\"leaf connect disabled: skipping remote %s\", url)\n}","preventionTips":["Keep leafnodes config and disable flags consistent (one source of truth)","Fail fast at startup when remotes are configured but disabled","Audit hardening flags when repurposing servers"],"tags":["nats","leafnode","disabled","configuration"],"backgroundTag":"feature-disabled","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}