{"record":{"id":"1546b91320baeae8","repo":"TechnitiumSoftware/DnsServer","slug":"no-authoritative-zone-was-found-zonename","errorCode":null,"errorMessage":"No authoritative zone was found: {zoneName}","messagePattern":"No authoritative zone was found: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs","lineNumber":2702,"sourceCode":"\n        public IReadOnlyList<DnsResourceRecord> SyncIncrementalZoneTransferRecords(string zoneName, IReadOnlyList<DnsResourceRecord> xfrRecords)\n        {\n            if ((xfrRecords.Count < 2) || (xfrRecords[0].Type != DnsResourceRecordType.SOA) || !xfrRecords[0].Name.Equals(zoneName, StringComparison.OrdinalIgnoreCase) || !xfrRecords[xfrRecords.Count - 1].Equals(xfrRecords[0]))\n                throw new DnsServerException(\"Invalid IXFR/AXFR response was received.\");\n\n            if ((xfrRecords.Count < 4) || (xfrRecords[1].Type != DnsResourceRecordType.SOA))\n            {\n                //received AXFR response\n                SyncZoneTransferRecords(zoneName, xfrRecords);\n                return Array.Empty<DnsResourceRecord>();\n            }\n\n            if (!_root.TryGet(zoneName, out ApexZone apexZone))\n                throw new InvalidOperationException(\"No such zone was found: \" + zoneName);\n\n            IReadOnlyList<DnsResourceRecord> soaRecords = apexZone.GetRecords(DnsResourceRecordType.SOA);\n            if (soaRecords.Count != 1)\n                throw new InvalidOperationException(\"No authoritative zone was found: \" + zoneName);\n\n            //process IXFR response\n            DnsResourceRecord currentSoaRecord = soaRecords[0];\n            DnsSOARecordData currentSoa = currentSoaRecord.RDATA as DnsSOARecordData;\n\n            List<DnsResourceRecord> condensedXfrRecords = CondenseIncrementalZoneTransferRecords(zoneName, currentSoaRecord, xfrRecords);\n\n            List<DnsResourceRecord> deletedRecords = new List<DnsResourceRecord>();\n            List<DnsResourceRecord> deletedGlueRecords = new List<DnsResourceRecord>();\n            List<DnsResourceRecord> addedRecords = new List<DnsResourceRecord>();\n            List<DnsResourceRecord> addedGlueRecords = new List<DnsResourceRecord>();\n\n            //read and apply difference sequences\n            int index = 1;\n            int count = condensedXfrRecords.Count - 1;\n\n            while (index < count)\n            {","sourceCodeStart":2684,"sourceCodeEnd":2720,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs#L2684-L2720","documentation":"Thrown by SyncIncrementalZoneTransferRecords when the zone exists (_root.TryGet succeeds) but apexZone.GetRecords(SOA).Count != 1. IXFR sync requires exactly one SOA to identify the current serial and apply incremental diffs. A zone with zero or multiple SOA records cannot be incrementally updated because the diff baseline is ambiguous.","triggerScenarios":"Calling SyncIncrementalZoneTransferRecords where the zone exists in _root but its SOA record is missing or duplicated. The zone passed the TryGet check (error 418) but fails SOA integrity. This can indicate zone corruption, a partially initialized zone, or a zone type that doesn't maintain SOA (stub).","commonSituations":"Zone corruption from a previous failed sync operation; zone in a partially-loaded state after restart; stub zone mistakenly receiving IXFR data; concurrent modification that left the SOA in an inconsistent state; zone file corruption causing SOA record duplication.","solutions":["Verify the zone has exactly one SOA record before calling SyncIncrementalZoneTransferRecords.","If SOA is missing or duplicated, fall back to full AXFR via SyncZoneTransferRecords to rebuild the zone.","Repair the zone file and reload the zone from disk.","Check for concurrent zone modification or failed prior sync operations."],"exampleFix":"// before\nvar deleted = authZoneManager.SyncIncrementalZoneTransferRecords(zoneName, xfrRecords);\n\n// after\nAuthZoneInfo info = authZoneManager.GetAuthZoneInfo(zoneName);\nif (info is null)\n    throw new InvalidOperationException(\"Zone not found.\");\nvar soaRecords = info.ApexZone.GetRecords(DnsResourceRecordType.SOA);\nif (soaRecords.Count != 1)\n{\n    _logger.LogError(\"Zone '{Zone}' has {Count} SOA records; falling back to full AXFR sync.\", zoneName, soaRecords.Count);\n    authZoneManager.SyncZoneTransferRecords(zoneName, xfrRecords);\n    return Array.Empty<DnsResourceRecord>();\n}\nvar deleted = authZoneManager.SyncIncrementalZoneTransferRecords(zoneName, xfrRecords);","handlingStrategy":"validation","validationCode":"AuthZoneInfo info = authZoneManager.GetAuthZoneInfo(zoneName);\nif (info is null)\n    throw new InvalidOperationException(\"Zone not found.\");\nvar soaRecords = info.ApexZone.GetRecords(DnsResourceRecordType.SOA);\nif (soaRecords.Count != 1)\n    throw new InvalidOperationException($\"Zone has {soaRecords.Count} SOA records; cannot sync IXFR.\");","typeGuard":"static bool ZoneHasSingleSoa(AuthZoneManager mgr, string zoneName)\n{\n    AuthZoneInfo info = mgr.GetAuthZoneInfo(zoneName);\n    if (info is null) return false;\n    return info.ApexZone.GetRecords(DnsResourceRecordType.SOA).Count == 1;\n}","tryCatchPattern":"try\n{\n    var deleted = authZoneManager.SyncIncrementalZoneTransferRecords(zoneName, xfrRecords);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"No authoritative zone was found\"))\n{\n    logger.LogError(\"IXFR sync failed for '{Zone}': SOA integrity broken. Falling back to AXFR.\", zoneName);\n    authZoneManager.SyncZoneTransferRecords(zoneName, xfrRecords);\n}","preventionTips":["Verify exactly one SOA record before syncing IXFR data.","Fall back to full AXFR sync when SOA integrity is compromised.","Check for prior failed sync operations that may have corrupted the zone.","Repair zone files and reload from disk if SOA is inconsistent."],"tags":["zone-transfer","ixfr","zone-management","soa","validation"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}