{"record":{"id":"12a6fcbdb8f06efd","repo":"TechnitiumSoftware/DnsServer","slug":"at-least-one-primary-name-server-address-must-be-s","errorCode":null,"errorMessage":"At least one primary name server address must be specified for {} zone.","messagePattern":"At least one primary name server address must be specified for (.+?) zone\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/Zones/SecondaryForwarderZone.cs","lineNumber":152,"sourceCode":"            {\n                switch (value)\n                {\n                    case AuthZoneUpdate.AllowOnlyZoneNameServers:\n                    case AuthZoneUpdate.AllowZoneNameServersAndUseSpecifiedNetworkACL:\n                        throw new ArgumentException(\"The Dynamic Updates option is invalid for Secondary Conditional Forwarder zones: \" + value.ToString(), nameof(Update));\n                }\n\n                base.Update = value;\n            }\n        }\n\n        public override IReadOnlyList<NameServerAddress> PrimaryNameServerAddresses\n        {\n            get { return base.PrimaryNameServerAddresses; }\n            set\n            {\n                if ((value is null) || (value.Count == 0))\n                    throw new ArgumentException(\"At least one primary name server address must be specified for \" + GetZoneTypeName() + \" zone.\", nameof(PrimaryNameServerAddresses));\n\n                base.PrimaryNameServerAddresses = value;\n            }\n        }\n\n        public override bool ValidateZone\n        {\n            get { return base.ValidateZone; }\n            set { throw new InvalidOperationException(); }\n        }\n\n        #endregion\n    }\n}\n","sourceCodeStart":134,"sourceCodeEnd":167,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/Zones/SecondaryForwarderZone.cs#L134-L167","documentation":"Thrown by the SecondaryForwarderZone.PrimaryNameServerAddresses setter when value is null or has zero entries. A secondary conditional forwarder must know where to forward queries, so an empty upstream list is rejected with ArgumentException naming the property.","triggerScenarios":"Setting zone.PrimaryNameServerAddresses = null or an empty list on a SecondaryForwarderZone.","commonSituations":"Building a forwarder zone from a config where upstream servers are optional and were omitted; clearing servers during reconfiguration before setting new ones; deserialization producing an empty array.","solutions":["Provide at least one NameServerAddress before assigning PrimaryNameServerAddresses.","Validate the upstream list is non-empty before constructing/assigning the zone.","Treat an empty upstream list as a configuration error at the source (config parser)."],"exampleFix":"// before\nzone.PrimaryNameServerAddresses = servers; // servers is null/empty\n\n// after\nif (servers is null || servers.Count == 0)\n    throw new ArgumentException(\"upstream servers required\");\nzone.PrimaryNameServerAddresses = servers;","handlingStrategy":"validation","validationCode":"if (value is null || value.Count == 0)\n    throw new ArgumentException(\"At least one upstream name server is required.\");\nzone.PrimaryNameServerAddresses = value;","typeGuard":"static bool HasUpstream(IReadOnlyList<NameServerAddress> v) =>\n    v is not null && v.Count > 0;","tryCatchPattern":"null","preventionTips":["Validate the upstream list at config-parse time, not at zone assignment.","Treat empty upstream servers as a hard configuration error."],"tags":["dns","secondary-forwarder-zone","name-servers","config","validation"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}