TechnitiumSoftware/DnsServer · error · InvalidDataException

DNS Zone file version not supported.

Error message

DNS Zone file version not supported.

What it means

Thrown by AuthZoneManager.LoadZoneFrom when the 1-byte version field of a 'DZ' zone file does not match any handled version (the switch handles 2, 3, and 4; the current writer emits 4). It signals a version mismatch between the file and the running code.

Source

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

                            {
                                records[i] = new DnsResourceRecord(s);
                                records[i].Tag = AuthRecordInfo.ReadGenericRecordInfoFrom(bR, records[i].Type);
                            }

                            //load and init zone
                            LoadAndInitZone(zoneInfo, records);
                        }
                        catch
                        {
                            DeleteZone(zoneInfo);
                            throw;
                        }

                        return zoneInfo;
                    }

                default:
                    throw new InvalidDataException("DNS Zone file version not supported.");
            }
        }

        public void WriteZoneTo(string zoneName, Stream s)
        {
            AuthZoneInfo zoneInfo = GetAuthZoneInfo(zoneName, true);
            if (zoneInfo is null)
                return;

            //serialize zone
            BinaryWriter bW = new BinaryWriter(s);

            bW.Write(Encoding.ASCII.GetBytes("DZ")); //format
            bW.Write((byte)4); //version

            //write zone info
            zoneInfo.WriteTo(bW);

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Upgrade to a Technitium version that supports the file's zone format version.
  2. Delete/re-create the zone (primary) or re-transfer (secondary) so it is written in the current version.
  3. Migrate configs with a matching version before starting the service.

Example fix

// before
zoneManager.LoadZoneFrom(fs, lastModified); // unknown version throws

// after
try { zoneManager.LoadZoneFrom(fs, lastModified); }
catch (InvalidDataException ex) when (ex.Message.Contains("version not supported")) {
    File.Delete(zonePath); // re-create zone on next run
}
Defensive patterns

Strategy: try-catch

Validate before calling

byte ZoneFileVersion(string path)
{
    using var fs = File.OpenRead(path);
    using var br = new BinaryReader(fs);
    if (Encoding.ASCII.GetString(br.ReadBytes(2)) != "DZ") return 0;
    return br.ReadByte();
}

Try / catch

try { zoneManager.LoadZoneFrom(fs, lastModified); }
catch (InvalidDataException ex) when (ex.Message.Contains("version not supported"))
{
    // version mismatch — upgrade, or delete/re-create the zone in the current version
    File.Delete(zonePath);
}

Prevention

When it happens

Trigger: Loading a 'DZ' zone file whose version byte is < 2, > 4, or from a future build that introduced version 5+.

Common situations: Downgrading Technitium past a format change (the older binary does not know the newer version), importing a zone file from a newer/forked build, or a corrupt version byte.

Related errors


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