TechnitiumSoftware/DnsServer · warning · InvalidDataException

CacheRecordInfo format version not supported.

Error message

CacheRecordInfo format version not supported.

What it means

Thrown by CacheRecordInfo's BinaryReader constructor when the version byte read from a cache record file is not the handled case. CacheRecordInfo is the metadata persisted for cached DNS records (including ECS subnet and response metadata). The default branch guards against unknown/corrupt cache formats so a bad cache entry cannot be silently reloaded.

Source

Thrown at DnsServerCore/Dns/ResourceRecords/CacheRecordInfo.cs:73

                case 1:
                case 2:
                    _glueRecords = ReadRecordsFrom(bR, true);
                    _rrsigRecords = ReadRecordsFrom(bR, false);
                    _nsecRecords = ReadRecordsFrom(bR, true);

                    if (bR.ReadBoolean())
                        _eDnsClientSubnet = NetworkAddress.ReadFrom(bR);

                    if (version >= 2)
                    {
                        if (bR.ReadBoolean())
                            _responseMetadata = new DnsDatagramMetadata(bR);
                    }

                    break;

                default:
                    throw new InvalidDataException("CacheRecordInfo format version not supported.");
            }
        }

        #endregion

        #region private

        private static DnsResourceRecord[] ReadRecordsFrom(BinaryReader bR, bool includeInnerRRSigRecords)
        {
            int count = bR.ReadByte();
            if (count == 0)
                return null;

            DnsResourceRecord[] records = new DnsResourceRecord[count];

            for (int i = 0; i < count; i++)
            {
                records[i] = DnsResourceRecord.ReadCacheRecordFrom(bR, delegate (DnsResourceRecord record)

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Clear the cache directory (stop server, delete the cache files, restart) so fresh cache entries are written in the current format.
  2. If reproducing a downgrade scenario, upgrade to the build that produced the cache to drain it, then downgrade.
  3. Confirm the stats/cache folder is not shared between two concurrently-running server instances of different versions.
Defensive patterns

Strategy: fallback

Try / catch

// Cache is rebuildable; on format error, treat the entry as a cache miss.
try { cached = new CacheRecordInfo(bR); }
catch (InvalidDataException ex) when (ex.Message == "CacheRecordInfo format version not supported.")
{ cached = null; /* re-resolve upstream */ }

Prevention

When it happens

Trigger: Reading a cached record from the on-disk cache whose version byte is unrecognized, or whose stream was truncated so the version reads as an unexpected value. Happens during cache load at startup or lazy cache page-in.

Common situations: Cache files left over from an incompatible server version; cache directory corruption after an unclean shutdown; copying cache files between machines running different builds.

Related errors


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