TechnitiumSoftware/DnsServer · error · InvalidDataException

DnsServer block list zone file version not supported.

Error message

DnsServer block list zone file version not supported.

What it means

Thrown by ReadConfigFrom's version switch default case: the block-list config file has a valid 'BL' header but its version byte is not '1' (the only supported writer version). This guards forward/backward incompatibility when a newer server wrote a version this build cannot read.

Source

Thrown at DnsServerCore/Dns/ZoneManagers/BlockListZoneManager.cs:276

                        ThreadPool.QueueUserWorkItem(delegate (object state)
                        {
                            try
                            {
                                LoadBlockLists();
                            }
                            catch (Exception ex)
                            {
                                _dnsServer.LogManager.Write(ex);
                            }
                        });
                    }

                    ApplyBlockListUrls(blockListUrls);
                    ApplyBlockListUpdateInterval();
                    break;

                default:
                    throw new InvalidDataException("DnsServer block list zone file version not supported.");
            }
        }

        private void WriteConfigTo(Stream s)
        {
            BinaryWriter bW = new BinaryWriter(s);

            bW.Write(Encoding.ASCII.GetBytes("BL")); //format
            bW.Write((byte)1); //version

            bW.Write(Convert.ToByte(_blockListUrls.Count));

            foreach (string blockListUrl in _blockListUrls)
                s.WriteShortString(blockListUrl);

            bW.Write(_blockListUpdateIntervalHours);
            s.WriteDateTime(_blockListLastUpdatedOn);
        }

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Upgrade the DNS server to a build that supports the file's version.
  2. Discard the block-list config file so a fresh version-1 file is written on next save, then reconfigure block list URLs.
  3. Restore from a backup written by the same (or older compatible) server version.

Example fix

// before: blockListZone.bin version byte = 2 on an older server -> throws
// after: delete to regenerate at the supported version
//   rm config/blockListZone.bin   (reconfigure block list URLs via UI after restart)
Defensive patterns

Strategy: validation

Validate before calling

static int? ReadBlockListVersion(string path)
{
    using var fs = File.OpenRead(path);
    Span<byte> hdr = stackalloc byte[3];
    if (fs.Read(hdr) != 3 || hdr[0] != (byte)'B' || hdr[1] != (byte)'L') return null;
    return hdr[2]; // supported == 1
}

Try / catch

try { blockListZoneManager.Load(); }
catch (InvalidDataException ex) when (ex.Message.Contains("version not supported"))
{ File.Delete(blockListPath); blockListZoneManager.Load(); } // regenerate at v1

Prevention

When it happens

Trigger: Downgrading the DNS server to an older build that cannot read a newer block-list file version; a hand-edited file with an arbitrary version byte; file partially rewritten so the version byte is garbage.

Common situations: Rolling back a server upgrade; copying config files between servers running different versions; corruption that altered the byte after the header.

Related errors


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