{"record":{"id":"19619455cd85c6d6","repo":"TechnitiumSoftware/DnsServer","slug":"name-server-addresses-cannot-have-more-than-255-en","errorCode":null,"errorMessage":"Name server addresses cannot have more than 255 entries.","messagePattern":"Name server addresses cannot have more than 255 entries\\.","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/Zones/ApexZone.cs","lineNumber":1388,"sourceCode":"            {\n                _notify = value;\n\n                lock (_notifyFailed)\n                {\n                    _notifyFailed.Clear();\n                }\n            }\n        }\n\n        public IReadOnlyCollection<IPAddress> NotifyNameServers\n        {\n            get { return _notifyNameServers; }\n            set\n            {\n                if ((value is null) || (value.Count == 0))\n                    _notifyNameServers = null;\n                else if (value.Count > byte.MaxValue)\n                    throw new ArgumentOutOfRangeException(nameof(NotifyNameServers), \"Name server addresses cannot have more than 255 entries.\");\n                else\n                    _notifyNameServers = value;\n\n                lock (_notifyFailed)\n                {\n                    _notifyFailed.Clear();\n                }\n            }\n        }\n\n        public IReadOnlyCollection<IPAddress> NotifySecondaryCatalogNameServers\n        {\n            get { return _notifySecondaryCatalogNameServers; }\n            set\n            {\n                if ((value is null) || (value.Count == 0))\n                    _notifySecondaryCatalogNameServers = null;\n                else if (value.Count > byte.MaxValue)","sourceCodeStart":1370,"sourceCodeEnd":1406,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/Zones/ApexZone.cs#L1370-L1406","documentation":"Thrown by the NotifyNameServers setter when the supplied IPAddress collection has more than 255 entries. The notify name-server list is persisted with a single-byte count, so > 255 is rejected; null/empty clears it. Setting also resets the _notifyFailed tracking state.","triggerScenarios":"Assigning > 255 NOTIFY target secondaries; importing a large secondary roster.","commonSituations":"Large multi-secondary deployments enumerating each IP; merging notify lists across zones.","solutions":["Trim NotifyNameServers to <= 255 IP addresses.","Route NOTIFY through a smaller set of forwarders/catalog secondaries rather than every leaf secondary.","Deduplicate IPv4/IPv6 duplicates before assigning."],"exampleFix":"// before\nzone.NotifyNameServers = secondaries; // Count > 255 -> throws\n// after\nzone.NotifyNameServers = secondaries.Distinct().Take(255).ToList();","handlingStrategy":"validation","validationCode":"if (servers != null && servers.Count > byte.MaxValue)\n    throw new InvalidOperationException($\"NotifyNameServers capped at 255 (got {servers.Count}).\");\nzone.NotifyNameServers = servers;","typeGuard":"static bool IsValidNotifyCount(IReadOnlyCollection<IPAddress> servers) => servers is null || servers.Count <= byte.MaxValue;","tryCatchPattern":"try { zone.NotifyNameServers = servers; }\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == nameof(zone.NotifyNameServers))\n{ zone.NotifyNameServers = servers.Distinct().Take(byte.MaxValue).ToList(); }","preventionTips":["Route NOTIFY through fewer catalog/hub secondaries.","Deduplicate IPv4/IPv6 addresses before assigning.","Enforce the 255 cap at the config boundary.","Catalog members can self-register instead of an exhaustive notify list."],"tags":["dns","notify","zone-transfer","validation","network"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}