{"record":{"id":"abb9927b8656230e","repo":"TechnitiumSoftware/DnsServer","slug":"cluster-node-cannot-have-more-than-10-ip-addresses","errorCode":null,"errorMessage":"Cluster node cannot have more than 10 IP addresses.","messagePattern":"Cluster node cannot have more than 10 IP addresses\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Cluster/ClusterNode.cs","lineNumber":104,"sourceCode":"                _lastSeen = DateTime.UtcNow;\n                _state = ClusterNodeState.Connected; //since this info was received from primary node\n            }\n            else\n            {\n                _state = ClusterNodeState.Unknown;\n            }\n        }\n\n        public ClusterNode(ClusterManager clusterManager, int id, Uri url, IReadOnlyList<IPAddress> ipAddresses, ClusterNodeType type, ClusterNodeState state)\n        {\n            if (url.OriginalString.Length > 255)\n                throw new ArgumentException(\"Cluster node URL length must be less than 255 bytes.\", nameof(url));\n\n            if (!url.Scheme.Equals(\"https\", StringComparison.OrdinalIgnoreCase))\n                throw new ArgumentException(\"Cluster node URL must use HTTPS scheme.\", nameof(url));\n\n            if (ipAddresses.Count > 10)\n                throw new ArgumentException(\"Cluster node cannot have more than 10 IP addresses.\", nameof(ipAddresses));\n\n            _clusterManager = clusterManager;\n\n            _id = id;\n            _url = url;\n            _ipAddresses = ipAddresses;\n            _type = type;\n            _state = state;\n        }\n\n        public ClusterNode(ClusterManager clusterManager, BinaryReader bR)\n        {\n            _clusterManager = clusterManager;\n\n            int version = bR.ReadByte();\n            switch (version)\n            {\n                case 1:","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Cluster/ClusterNode.cs#L86-L122","documentation":"Constructor argument guard on the explicit ClusterNode overload. It rejects more than 10 IP addresses for a single node. The cap keeps the serialized node record compact (count written as a single byte via WriteTo, but capped well under 255 for practical heartbeat/cluster-state payload size) and matches the design assumption that a node is identified by a small set of addresses.","triggerScenarios":"Passing an IReadOnlyList<IPAddress> with Count > 10 to the 5-parameter ClusterNode constructor.","commonSituations":"Resolving a node's DNS name to many A/AAAA records and passing all of them; enumerating all interface addresses of a multi-homed host; a bug that duplicates addresses into the list instead of de-duplicating.","solutions":["De-duplicate and trim the IP address list to the essential reachable addresses (max 10).","Prefer the node's primary/stable addresses (public + one internal) rather than every interface IP.","If you genuinely need more than 10, reconsider node topology (split into more nodes).","Validate ipAddresses.Count <= 10 before constructing the node."],"exampleFix":"// before\nvar ips = allInterfaceAddresses; // 15 addresses, incl. duplicates\nvar node = new ClusterNode(mgr, id, url, ips, type, state); // throws [203]\n\n// after: de-dup + cap at 10\nvar ips = allInterfaceAddresses.Distinct().Take(10).ToList();\nvar node = new ClusterNode(mgr, id, url, ips, type, state);","handlingStrategy":"validation","validationCode":"const int MAX_CLUSTER_NODE_IPS = 10;\nif (ipAddresses.Count > MAX_CLUSTER_NODE_IPS)\n    throw new ArgumentException($\"Cluster node supports at most {MAX_CLUSTER_NODE_IPS} IP addresses.\", nameof(ipAddresses));\n\nvar node = new ClusterNode(mgr, id, url, ipAddresses, type, state);","typeGuard":"static bool IsAcceptableIpList(IReadOnlyList<IPAddress> ips) =>\n    ips is not null && ips.Count <= 10;","tryCatchPattern":null,"preventionTips":["De-duplicate IP addresses before assigning them to a node.","Prefer the node's stable primary addresses over every interface address.","Cap candidate lists at 10."],"tags":["cluster","validation","constructor","ip-addresses"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}