TechnitiumSoftware/DnsServer · error · DnsServerException

No such zone was found: <sourceZoneName or ".">

Error message

No such zone was found: <sourceZoneName or ".">

What it means

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.

Source

Thrown at DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs:1304

                        _dnsServer.LogManager.Write("Deleted zone file for domain: " + zoneInfo.DisplayName);
                    }

                    return true;
                }
            }
            finally
            {
                _zoneIndexLock.ExitWriteLock();
            }

            return false;
        }

        public AuthZoneInfo CloneZone(string zoneName, string sourceZoneName)
        {
            AuthZoneInfo sourceZoneInfo = GetAuthZoneInfo(sourceZoneName);
            if (sourceZoneInfo is null)
                throw new DnsServerException("No such zone was found: " + (sourceZoneName.Length == 0 ? "." : sourceZoneName));

            AuthZoneInfo zoneInfo;

            switch (sourceZoneInfo.Type)
            {
                case AuthZoneType.Primary:
                    zoneInfo = CreatePrimaryZone(zoneName);
                    break;

                case AuthZoneType.Forwarder:
                    zoneInfo = CreateForwarderZone(zoneName);
                    break;

                default:
                    throw new DnsServerException("Cannot clone the zone: source zone must be a Primary or Conditional Forwarder zone.");
            }

            if (zoneInfo is null)

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Verify the source zone name exists by calling GetAuthZoneInfo(sourceZoneName) before CloneZone and checking for non-null.
  2. Normalize the name: trim whitespace, strip trailing '.', and for the root zone pass the name the server actually registered.
  3. Re-fetch the zone list to confirm the source zone is still present.
  4. Wrap the call in try/catch for DnsServerException and report 'source zone not found' to the caller with the resolved name.

Example fix

// before
manager.CloneZone("copy.example.com", sourceZoneName); // throws if missing

// after
if (manager.GetAuthZoneInfo(sourceZoneName) is null)
    return NotFound($"Source zone '{sourceZoneName}' does not exist.");
manager.CloneZone("copy.example.com", sourceZoneName);
Defensive patterns

Strategy: validation

Validate before calling

if (manager.GetAuthZoneInfo(sourceZoneName) is null)
    return NotFound($"Source zone '{sourceZoneName}' does not exist.");

Try / catch

try { manager.CloneZone(newName, sourceName); }
catch (DnsServerException ex) when (ex.Message.StartsWith("No such zone was found")) { return NotFound(ex.Message); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/0ad36b5706e6e846. Report an issue: GitHub.