{"record":{"id":"13191b6f84d9f849","repo":"TechnitiumSoftware/DnsServer","slug":"maxmind-country-file-is-missing","errorCode":null,"errorMessage":"MaxMind Country file is missing!","messagePattern":"MaxMind Country file is missing!","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"critical","filePath":"Apps/GeoContinentApp/MaxMind.cs","lineNumber":49,"sourceCode":"        static MaxMind? _maxMind;\n\n        readonly DatabaseReader _mmCountryReader;\n        readonly DatabaseReader? _mmIspReader;\n        readonly DatabaseReader? _mmAsnReader;\n\n        #endregion\n\n        #region constructor\n\n        private MaxMind(IDnsServer dnsServer)\n        {\n            string mmCountryFile = Path.Combine(dnsServer.ApplicationFolder, \"GeoIP2-Country.mmdb\");\n\n            if (!File.Exists(mmCountryFile))\n                mmCountryFile = Path.Combine(dnsServer.ApplicationFolder, \"GeoLite2-Country.mmdb\");\n\n            if (!File.Exists(mmCountryFile))\n                throw new FileNotFoundException(\"MaxMind Country file is missing!\");\n\n            _mmCountryReader = new DatabaseReader(mmCountryFile);\n\n            string mmIspFile = Path.Combine(dnsServer.ApplicationFolder, \"GeoIP2-ISP.mmdb\");\n            if (File.Exists(mmIspFile))\n            {\n                _mmIspReader = new DatabaseReader(mmIspFile);\n                return;\n            }\n\n            string mmAsnFile = Path.Combine(dnsServer.ApplicationFolder, \"GeoLite2-ASN.mmdb\");\n            if (File.Exists(mmAsnFile))\n                _mmAsnReader = new DatabaseReader(mmAsnFile);\n        }\n\n        #endregion\n\n        #region IDisposable","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/Apps/GeoContinentApp/MaxMind.cs#L31-L67","documentation":"Thrown by the GeoContinentApp MaxMind constructor when neither GeoIP2-Country.mmdb nor GeoLite2-Country.mmdb exists in dnsServer.ApplicationFolder. It is a FileNotFoundException and is the upstream cause of the 'MaxMind database not initialized' errors 26 and 27: once this throws, _maxMind stays null.","triggerScenarios":"GeoContinentApp initialisation runs, the constructor looks for the commercial GeoIP2-Country.mmdb first, falls back to the free GeoLite2-Country.mmdb, and if both are absent throws. Reached at server/app startup or when the app is reloaded.","commonSituations":"New deployment that forgot to download the GeoIP database, container image that does not bake in the .mmdb files, file path permissions, or accidental deletion of the database.","solutions":["Sign up at MaxMind and download GeoLite2-Country.mmdb (free) or GeoIP2-Country.mmdb (paid).","Copy the file into the DNS server ApplicationFolder (the same folder returned by IDnsServer.ApplicationFolder).","Restart the DnsServer process so the MaxMind constructor finds the file and initialises the readers."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"string folder = dnsServer.ApplicationFolder;\nstring[] candidates = { Path.Combine(folder,\"GeoIP2-Country.mmdb\"), Path.Combine(folder,\"GeoLite2-Country.mmdb\") };\nif (!candidates.Any(File.Exists))\n    throw new ConfigValidationException(\"GeoContinentApp requires GeoIP2-Country.mmdb or GeoLite2-Country.mmdb in: \" + folder);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bake the GeoLite2-Country.mmdb file into deployment images.","Add a pre-start script verifying the .mmdb file exists.","Automate MaxMind database downloads with a licence key."],"tags":["geo","maxmind","file-not-found","startup","config"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}