{"record":{"id":"b20de068db793760","repo":"TechnitiumSoftware/DnsServer","slug":"authzoneinfo-format-version-not-supported","errorCode":null,"errorMessage":"AuthZoneInfo format version not supported.","messagePattern":"AuthZoneInfo format version not supported\\.","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"critical","filePath":"DnsServerCore/Dns/Zones/AuthZoneInfo.cs","lineNumber":648,"sourceCode":"\n                                _zoneTransfer = (AuthZoneTransfer)bR.ReadByte();\n                                _zoneTransferNetworkACL = ReadNetworkACLFrom(bR);\n                                _zoneTransferTsigKeyNames = ReadZoneTransferTsigKeyNamesFrom(bR);\n\n                                _primaryNameServerAddresses = ReadNameServerAddressesFrom(bR);\n                                _primaryZoneTransferProtocol = (DnsTransportProtocol)bR.ReadByte();\n                                _primaryZoneTransferTsigKeyName = bR.BaseStream.ReadShortString();\n                                if (_primaryZoneTransferTsigKeyName.Length == 0)\n                                    _primaryZoneTransferTsigKeyName = null;\n\n                                _expiry = bR.BaseStream.ReadDateTime();\n                                break;\n                        }\n                    }\n                    break;\n\n                default:\n                    throw new InvalidDataException(\"AuthZoneInfo format version not supported.\");\n            }\n        }\n\n        internal AuthZoneInfo(ApexZone apexZone, bool loadHistory = false)\n        {\n            _apexZone = apexZone;\n            _name = _apexZone.Name;\n            _lastModified = _apexZone.LastModified;\n            _disabled = _apexZone.Disabled;\n\n            if (_apexZone is PrimaryZone primaryZone)\n            {\n                _type = AuthZoneType.Primary;\n\n                _catalogZoneName = _apexZone.CatalogZoneName;\n                _overrideCatalogQueryAccess = _apexZone.OverrideCatalogQueryAccess;\n                _overrideCatalogZoneTransfer = _apexZone.OverrideCatalogZoneTransfer;\n                _overrideCatalogNotify = _apexZone.OverrideCatalogNotify;","sourceCodeStart":630,"sourceCodeEnd":666,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/Zones/AuthZoneInfo.cs#L630-L666","documentation":"AuthZoneInfo's BinaryReader constructor reads a version byte from the serialized zone data and dispatches on it via a switch statement supporting versions 1 through 14. If the version byte is outside this range (0 or >14), the default case throws InvalidDataException. The current writer emits version 14 (line 1194: bW.Write((byte)14)). This error means the on-disk zone file was written by a newer, incompatible server version, or the file is corrupted/truncated.","triggerScenarios":"Loading a zone info file (.zone file in the config/zones directory) whose version byte is not in {1..14}. Occurs at server startup or when the AuthZoneManager loads zone persistence data from disk.","commonSituations":"Downgrading the DNS server to an older version after running a newer one that wrote a higher format version; copying zone files between servers of different versions; file corruption from an improper shutdown, disk failure, or partial write; manually editing or truncating zone files.","solutions":["Upgrade the DNS server to a version that supports the format version indicated by the zone file (check CHANGELOG.md for version bumps).","If the file is corrupted, restore from backup or delete the zone file and recreate the zone manually.","If downgrading is required, export zones in a compatible format from the newer version first, then re-import after downgrade.","Inspect the zone file's first byte to confirm the version number and diagnose whether it is corruption (unexpected value like 0 or 255) or a genuine version mismatch."],"exampleFix":"// Not a code fix — this is a data/format compatibility issue.\n// Check the file's version byte:\n//   var version = File.OpenRead(zonePath).ReadByte();\n// If version > 14: upgrade the DNS server binary.\n// If version is garbage (0, 255): restore from backup.","handlingStrategy":"try-catch","validationCode":"// Pre-check the zone file version byte before attempting full load\nusing (var fs = File.OpenRead(zoneFilePath))\n{\n    int version = fs.ReadByte();\n    if (version < 1 || version > 14)\n        throw new InvalidDataException($\"Zone file '{zoneFilePath}' has unsupported format version {version}. Supported: 1-14.\");\n}","typeGuard":null,"tryCatchPattern":"try { zoneInfo = new AuthZoneInfo(bR, lastModified); }\ncatch (InvalidDataException ex) when (ex.Message.Contains(\"format version\"))\n{\n    // log the file path, alert admin about version mismatch or corruption\n    // restore from backup or skip the zone\n}","preventionTips":["Do not downgrade the DNS server below the version that wrote the zone files.","Export zones before upgrading in case rollback is needed.","Maintain backups of zone config directories.","Monitor server startup logs for InvalidDataException to catch corruption early."],"tags":["dns","serialization","version-mismatch","data-corruption","auth-zone-info"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}