{"record":{"id":"7592748bc70ba832","repo":"TechnitiumSoftware/DnsServer","slug":"cacherecordinfo-format-version-not-supported","errorCode":null,"errorMessage":"CacheRecordInfo format version not supported.","messagePattern":"CacheRecordInfo format version not supported\\.","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"warning","filePath":"DnsServerCore/Dns/ResourceRecords/CacheRecordInfo.cs","lineNumber":73,"sourceCode":"                case 1:\n                case 2:\n                    _glueRecords = ReadRecordsFrom(bR, true);\n                    _rrsigRecords = ReadRecordsFrom(bR, false);\n                    _nsecRecords = ReadRecordsFrom(bR, true);\n\n                    if (bR.ReadBoolean())\n                        _eDnsClientSubnet = NetworkAddress.ReadFrom(bR);\n\n                    if (version >= 2)\n                    {\n                        if (bR.ReadBoolean())\n                            _responseMetadata = new DnsDatagramMetadata(bR);\n                    }\n\n                    break;\n\n                default:\n                    throw new InvalidDataException(\"CacheRecordInfo format version not supported.\");\n            }\n        }\n\n        #endregion\n\n        #region private\n\n        private static DnsResourceRecord[] ReadRecordsFrom(BinaryReader bR, bool includeInnerRRSigRecords)\n        {\n            int count = bR.ReadByte();\n            if (count == 0)\n                return null;\n\n            DnsResourceRecord[] records = new DnsResourceRecord[count];\n\n            for (int i = 0; i < count; i++)\n            {\n                records[i] = DnsResourceRecord.ReadCacheRecordFrom(bR, delegate (DnsResourceRecord record)","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/ResourceRecords/CacheRecordInfo.cs#L55-L91","documentation":"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.","triggerScenarios":"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.","commonSituations":"Cache files left over from an incompatible server version; cache directory corruption after an unclean shutdown; copying cache files between machines running different builds.","solutions":["Clear the cache directory (stop server, delete the cache files, restart) so fresh cache entries are written in the current format.","If reproducing a downgrade scenario, upgrade to the build that produced the cache to drain it, then downgrade.","Confirm the stats/cache folder is not shared between two concurrently-running server instances of different versions."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Cache is rebuildable; on format error, treat the entry as a cache miss.\ntry { cached = new CacheRecordInfo(bR); }\ncatch (InvalidDataException ex) when (ex.Message == \"CacheRecordInfo format version not supported.\")\n{ cached = null; /* re-resolve upstream */ }","preventionTips":["Treat the cache as disposable; clear it when changing server versions.","Do not share a cache directory between concurrent instances of different builds."],"tags":["serialization","cache-record","version","deserialization","cache"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}