TechnitiumSoftware/DnsServer · error · InvalidOperationException

No such zone was found: {zoneName}

Error message

No such zone was found: {zoneName}

What it means

Thrown by SyncIncrementalZoneTransferRecords when the IXFR response passes envelope validation but _root.TryGet(zoneName, out ApexZone) fails. This means the zone was removed from the local tree between the transfer request and the sync call. It is an InvalidOperationException with the zone name in the message.

Source

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

            apexZone.UpdateDnssecStatus();

            SaveZoneFile(apexZone.Name);
        }

        public IReadOnlyList<DnsResourceRecord> SyncIncrementalZoneTransferRecords(string zoneName, IReadOnlyList<DnsResourceRecord> xfrRecords)
        {
            if ((xfrRecords.Count < 2) || (xfrRecords[0].Type != DnsResourceRecordType.SOA) || !xfrRecords[0].Name.Equals(zoneName, StringComparison.OrdinalIgnoreCase) || !xfrRecords[xfrRecords.Count - 1].Equals(xfrRecords[0]))
                throw new DnsServerException("Invalid IXFR/AXFR response was received.");

            if ((xfrRecords.Count < 4) || (xfrRecords[1].Type != DnsResourceRecordType.SOA))
            {
                //received AXFR response
                SyncZoneTransferRecords(zoneName, xfrRecords);
                return Array.Empty<DnsResourceRecord>();
            }

            if (!_root.TryGet(zoneName, out ApexZone apexZone))
                throw new InvalidOperationException("No such zone was found: " + zoneName);

            IReadOnlyList<DnsResourceRecord> soaRecords = apexZone.GetRecords(DnsResourceRecordType.SOA);
            if (soaRecords.Count != 1)
                throw new InvalidOperationException("No authoritative zone was found: " + zoneName);

            //process IXFR response
            DnsResourceRecord currentSoaRecord = soaRecords[0];
            DnsSOARecordData currentSoa = currentSoaRecord.RDATA as DnsSOARecordData;

            List<DnsResourceRecord> condensedXfrRecords = CondenseIncrementalZoneTransferRecords(zoneName, currentSoaRecord, xfrRecords);

            List<DnsResourceRecord> deletedRecords = new List<DnsResourceRecord>();
            List<DnsResourceRecord> deletedGlueRecords = new List<DnsResourceRecord>();
            List<DnsResourceRecord> addedRecords = new List<DnsResourceRecord>();
            List<DnsResourceRecord> addedGlueRecords = new List<DnsResourceRecord>();

            //read and apply difference sequences
            int index = 1;

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Check _root.TryGet or GetAuthZoneInfo before calling SyncIncrementalZoneTransferRecords to confirm the zone still exists.
  2. If the zone was intentionally deleted, discard the transfer data gracefully.
  3. Implement zone-level locking to prevent deletion during active transfers.
  4. Log the condition and alert if unexpected.

Example fix

// before
var deleted = authZoneManager.SyncIncrementalZoneTransferRecords(zoneName, xfrRecords);

// after
if (authZoneManager.GetAuthZoneInfo(zoneName) is null)
{
    _logger.LogWarning("Zone '{Zone}' was removed during IXFR; discarding transfer data.", zoneName);
    return Array.Empty<DnsResourceRecord>();
}
var deleted = authZoneManager.SyncIncrementalZoneTransferRecords(zoneName, xfrRecords);
Defensive patterns

Strategy: validation

Validate before calling

if (authZoneManager.GetAuthZoneInfo(zoneName) is null)
{
    logger.LogWarning("Zone '{Zone}' was removed during IXFR; discarding transfer data.", zoneName);
    return Array.Empty<DnsResourceRecord>();
}

Type guard

static bool ZoneStillExists(AuthZoneManager mgr, string zoneName)
    => mgr.GetAuthZoneInfo(zoneName) is not null;

Try / catch

try
{
    var deleted = authZoneManager.SyncIncrementalZoneTransferRecords(zoneName, xfrRecords);
}
catch (InvalidOperationException ex) when (ex.Message.StartsWith("No such zone was found"))
{
    logger.LogInformation("IXFR sync skipped: zone '{Zone}' was removed.", zoneName);
}

Prevention

When it happens

Trigger: Calling SyncIncrementalZoneTransferRecords where the zone no longer exists in _root. The xfrRecords passed validation (valid SOA envelope), and the response is determined to be IXFR format (count >= 4, second record is SOA). The zone was deleted (by admin or automation) in the time window between fetching the transfer data and calling sync.

Common situations: Race condition: zone deleted by another admin/thread while IXFR data is in transit; automated zone lifecycle that deletes and recreates zones; zone file removed from disk and server reloaded during transfer; transfer retry arriving after zone removal.

Related errors


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