{"record":{"id":"5f30cd5f39b6f599","repo":"TechnitiumSoftware/DnsServer","slug":"dns-server-config-version-not-supported","errorCode":null,"errorMessage":"DNS Server config version not supported.","messagePattern":"DNS Server config version not supported\\.","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/DnsServer.cs","lineNumber":680,"sourceCode":"\n                if (_pendingSave)\n                    return;\n\n                _pendingSave = true;\n                _saveTimer.Change(SAVE_TIMER_INITIAL_INTERVAL, Timeout.Infinite);\n            }\n        }\n\n        private void ReadConfigFrom(Stream s, bool isConfigTransfer)\n        {\n            if (Encoding.ASCII.GetString(s.ReadExactly(2)) != \"DC\") //format\n                throw new InvalidDataException(\"DNS Server config file format is invalid.\");\n\n            BinaryReader bR = new BinaryReader(s);\n\n            int version = bR.ReadByte();\n            if ((version < 1) || (version > 5))\n                throw new InvalidDataException(\"DNS Server config version not supported.\");\n\n            //general\n            string serverDomain = s.ReadShortString();\n            if (!isConfigTransfer)\n            {\n                try\n                {\n                    ServerDomain = serverDomain;\n                }\n                catch\n                {\n                    //server domain failed validation\n                    _serverDomain = serverDomain;\n                }\n            }\n\n            {\n                IPEndPoint[] localEndPoints;","sourceCodeStart":662,"sourceCodeEnd":698,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/DnsServer.cs#L662-L698","documentation":"Thrown by ReadConfigFrom when the version byte read after the 'DC' magic is outside the supported range (currently 1-5). Each config revision bumps the version; an out-of-range value means the file is from an older or newer build than this binary understands.","triggerScenarios":"Loading a config file written by a much newer server version (version > 5) into an older build, or by an older build (< 1, essentially corruption) into this one. Also a partially overwritten byte after the magic.","commonSituations":"Downgrade: installing an older Technitium build then importing a config from a newer one; cross-version node replication where peers run mismatched versions; bit-rot altering the version byte.","solutions":["Upgrade the running server to at least the version that wrote the config, then re-import.","If downgrading is required, export from the older version's own format rather than reusing a newer config.","Ensure all cluster nodes run the same server build before transferring configs.","Re-save the config on the originating version and migrate fields manually if a true downgrade is needed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"static readonly Range Supported = 1..5;\nint ReadConfigVersion(string path)\n{\n    using var f = File.OpenRead(path);\n    f.Seek(2, SeekOrigin.Begin);\n    return f.ReadByte();\n}\nbool IsSupportedVersion(int v) => v >= 1 && v <= 5;","typeGuard":"static bool IsSupportedConfigVersion(string path)\n{\n    var v = ReadConfigVersion(path);\n    return v is >= 1 and <= 5;\n}","tryCatchPattern":"try { server.ReadConfigFrom(stream, false); }\ncatch (InvalidDataException ex) when (ex.Message.Contains(\"version not supported\")) { return BadRequest($\"Config version mismatch; upgrade the server to read this file\"); }","preventionTips":["Keep cluster nodes on the same server version.","Re-export configs after a downgrade rather than reusing newer files.","Check the version byte before import."],"tags":["config","version-mismatch","upgrade","compatibility"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}