{"record":{"id":"0ad36b5706e6e846","repo":"TechnitiumSoftware/DnsServer","slug":"no-such-zone-was-found-sourcezonename-or","errorCode":null,"errorMessage":"No such zone was found: <sourceZoneName or \".\">","messagePattern":"No such zone was found: <sourceZoneName or \"\\.\">","errorType":"exception","errorClass":"DnsServerException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs","lineNumber":1304,"sourceCode":"                        _dnsServer.LogManager.Write(\"Deleted zone file for domain: \" + zoneInfo.DisplayName);\n                    }\n\n                    return true;\n                }\n            }\n            finally\n            {\n                _zoneIndexLock.ExitWriteLock();\n            }\n\n            return false;\n        }\n\n        public AuthZoneInfo CloneZone(string zoneName, string sourceZoneName)\n        {\n            AuthZoneInfo sourceZoneInfo = GetAuthZoneInfo(sourceZoneName);\n            if (sourceZoneInfo is null)\n                throw new DnsServerException(\"No such zone was found: \" + (sourceZoneName.Length == 0 ? \".\" : sourceZoneName));\n\n            AuthZoneInfo zoneInfo;\n\n            switch (sourceZoneInfo.Type)\n            {\n                case AuthZoneType.Primary:\n                    zoneInfo = CreatePrimaryZone(zoneName);\n                    break;\n\n                case AuthZoneType.Forwarder:\n                    zoneInfo = CreateForwarderZone(zoneName);\n                    break;\n\n                default:\n                    throw new DnsServerException(\"Cannot clone the zone: source zone must be a Primary or Conditional Forwarder zone.\");\n            }\n\n            if (zoneInfo is null)","sourceCodeStart":1286,"sourceCodeEnd":1322,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs#L1286-L1322","documentation":"Thrown by CloneZone when GetAuthZoneInfo(sourceZoneName) returns null, meaning no authoritative zone node exists for the given source name (or the node has no ApexZone). An empty source name is reported as '.' to represent the root zone, matching the library's display convention.","triggerScenarios":"Calling CloneZone(zoneName, sourceZoneName) where sourceZoneName is misspelled, uses wrong casing, lacks a trailing label, refers to a deleted zone, or is the empty string while no root zone exists. GetAuthZoneInfo performs _root.TryGet + ApexZone-not-null check and returns null in all those cases.","commonSituations":"Race where the source zone was deleted between listing zones and calling CloneZone. Frontend/API passing the source name from a stale dropdown. Using FQDN with a trailing dot vs without. Typo or whitespace in the zone name string.","solutions":["Verify the source zone name exists by calling GetAuthZoneInfo(sourceZoneName) before CloneZone and checking for non-null.","Normalize the name: trim whitespace, strip trailing '.', and for the root zone pass the name the server actually registered.","Re-fetch the zone list to confirm the source zone is still present.","Wrap the call in try/catch for DnsServerException and report 'source zone not found' to the caller with the resolved name."],"exampleFix":"// before\nmanager.CloneZone(\"copy.example.com\", sourceZoneName); // throws if missing\n\n// after\nif (manager.GetAuthZoneInfo(sourceZoneName) is null)\n    return NotFound($\"Source zone '{sourceZoneName}' does not exist.\");\nmanager.CloneZone(\"copy.example.com\", sourceZoneName);","handlingStrategy":"validation","validationCode":"if (manager.GetAuthZoneInfo(sourceZoneName) is null)\n    return NotFound($\"Source zone '{sourceZoneName}' does not exist.\");","typeGuard":null,"tryCatchPattern":"try { manager.CloneZone(newName, sourceName); }\ncatch (DnsServerException ex) when (ex.Message.StartsWith(\"No such zone was found\")) { return NotFound(ex.Message); }","preventionTips":["Always resolve source zones via GetAuthZoneInfo before cloning.","Normalize zone names (trim whitespace, strip trailing dot) before lookup.","Refresh the zone list before user-driven clone operations."],"tags":["dns","zone-management","clone","not-found","input-validation"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}