{"record":{"id":"006397b7f3838c6f","repo":"TechnitiumSoftware/DnsServer","slug":"no-such-zone-was-found-zonename-or","errorCode":null,"errorMessage":"No such zone was found: <zoneName or \".\">","messagePattern":"No such zone was found: <zoneName or \"\\.\">","errorType":"exception","errorClass":"DnsServerException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs","lineNumber":1438,"sourceCode":"                        newRecords.Add(newRecord);\n                        break;\n                }\n            }\n\n            //load and init zone\n            LoadAndInitZone(zoneInfo, newRecords);\n\n            //save zone file\n            SaveZoneFile(zoneInfo.Name);\n\n            return zoneInfo;\n        }\n\n        public AuthZoneInfo ConvertZoneTypeTo(string zoneName, AuthZoneType newType)\n        {\n            AuthZoneInfo currentZoneInfo = GetAuthZoneInfo(zoneName);\n            if (currentZoneInfo is null)\n                throw new DnsServerException(\"No such zone was found: \" + (zoneName.Length == 0 ? \".\" : zoneName));\n\n            //validate conversion type\n            if (currentZoneInfo.Type == newType)\n                throw new DnsServerException(\"Cannot convert the zone '\" + currentZoneInfo.DisplayName + \"' from \" + currentZoneInfo.TypeName + \" to \" + AuthZoneInfo.GetZoneTypeName(newType) + \" zone: the zone is already of the same type.\");\n\n            switch (currentZoneInfo.Type)\n            {\n                case AuthZoneType.Primary:\n                    switch (newType)\n                    {\n                        case AuthZoneType.Forwarder:\n                            if (currentZoneInfo.ApexZone.DnssecStatus != AuthZoneDnssecStatus.Unsigned)\n                                throw new DnsServerException(\"Cannot convert the zone '\" + currentZoneInfo.DisplayName + \"' from \" + currentZoneInfo.TypeName + \" to \" + AuthZoneInfo.GetZoneTypeName(newType) + \" zone: converting the zone will cause lose of DNSSEC private keys.\");\n\n                            break;\n\n                        default:\n                            throw new DnsServerException(\"Cannot convert the zone '\" + currentZoneInfo.DisplayName + \"' from \" + currentZoneInfo.TypeName + \" to \" + AuthZoneInfo.GetZoneTypeName(newType) + \" zone: not supported.\");","sourceCodeStart":1420,"sourceCodeEnd":1456,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs#L1420-L1456","documentation":"Thrown by the public ConvertZoneTypeTo(string, AuthZoneType) when GetAuthZoneInfo(zoneName) returns null. Identical lookup semantics to error 381: the zone name is unknown, deleted, or malformed, and an empty name is displayed as '.'.","triggerScenarios":"Calling ConvertZoneTypeTo(zoneName, newType) with a zoneName that does not resolve to an authoritative ApexZone. The null-check at line 1437 fires immediately after the GetAuthZoneInfo call.","commonSituations":"Converting a zone that was just deleted. Misspelled name or wrong casing. Passing the zone's display name instead of its canonical name. Race between a delete and a convert.","solutions":["Confirm the zone exists via GetAuthZoneInfo(zoneName) before converting.","Normalize the name (trim, strip trailing dot) and re-resolve.","Refresh the zone list to ensure the target is still present.","Catch DnsServerException and surface a 'zone not found' error to the API caller."],"exampleFix":"// before\nmanager.ConvertZoneTypeTo(zoneName, AuthZoneType.Primary); // throws if missing\n\n// after\nif (manager.GetAuthZoneInfo(zoneName) is null)\n    return NotFound($\"Zone '{zoneName}' not found; cannot convert.\");\nmanager.ConvertZoneTypeTo(zoneName, AuthZoneType.Primary);","handlingStrategy":"validation","validationCode":"if (manager.GetAuthZoneInfo(zoneName) is null)\n    return NotFound($\"Zone '{zoneName}' not found; cannot convert.\");","typeGuard":null,"tryCatchPattern":"try { manager.ConvertZoneTypeTo(zoneName, newType); }\ncatch (DnsServerException ex) when (ex.Message.StartsWith(\"No such zone was found\")) { return NotFound(ex.Message); }","preventionTips":["Resolve and confirm the zone before converting.","Normalize the zone name before lookup.","Refresh zone state before type conversions."],"tags":["dns","zone-management","convert","not-found","input-validation"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}