{"record":{"id":"c4604f989894a262","repo":"TechnitiumSoftware/DnsServer","slug":"maxmind-city-file-is-missing","errorCode":null,"errorMessage":"MaxMind City file is missing!","messagePattern":"MaxMind City file is missing!","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"critical","filePath":"Apps/GeoDistanceApp/MaxMind.cs","lineNumber":49,"sourceCode":"        static MaxMind? _maxMind;\n\n        readonly DatabaseReader _mmCityReader;\n        readonly DatabaseReader? _mmIspReader;\n        readonly DatabaseReader? _mmAsnReader;\n\n        #endregion\n\n        #region constructor\n\n        private MaxMind(IDnsServer dnsServer)\n        {\n            string mmCityFile = Path.Combine(dnsServer.ApplicationFolder, \"GeoIP2-City.mmdb\");\n\n            if (!File.Exists(mmCityFile))\n                mmCityFile = Path.Combine(dnsServer.ApplicationFolder, \"GeoLite2-City.mmdb\");\n\n            if (!File.Exists(mmCityFile))\n                throw new FileNotFoundException(\"MaxMind City file is missing!\");\n\n            _mmCityReader = new DatabaseReader(mmCityFile);\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/GeoDistanceApp/MaxMind.cs#L31-L67","documentation":"Thrown by the GeoDistanceApp MaxMind constructor when neither GeoIP2-City.mmdb nor GeoLite2-City.mmdb exists in ApplicationFolder. Note this is the City database, not Country: GeoDistanceApp needs city-level coordinates to compute distance. FileNotFoundException at construction; it is the upstream cause of errors 32 and 33.","triggerScenarios":"GeoDistanceApp initialisation looks for the commercial City database first, falls back to GeoLite2-City.mmdb, and throws if both are absent. Reached at server/app startup or reload.","commonSituations":"Operator deployed the Country database (used by other geo apps) but forgot GeoDistanceApp needs the larger City database; container image missing the City .mmdb; or file deleted.","solutions":["Download GeoLite2-City.mmdb (or GeoIP2-City.mmdb) from MaxMind — note this is a different, larger file than the Country database.","Copy it into the DNS server ApplicationFolder.","Restart the DnsServer process so the MaxMind constructor finds it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"string folder = dnsServer.ApplicationFolder;\nstring[] candidates = { Path.Combine(folder,\"GeoIP2-City.mmdb\"), Path.Combine(folder,\"GeoLite2-City.mmdb\") };\nif (!candidates.Any(File.Exists))\n    throw new ConfigValidationException(\"GeoDistanceApp requires GeoIP2-City.mmdb or GeoLite2-City.mmdb in: \" + folder);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["GeoDistanceApp needs the City database, which is distinct from Country — deploy the right file.","Bake GeoLite2-City.mmdb into deployment images.","Run a pre-start file-existence check."],"tags":["geo","maxmind","city","distance","file-not-found","startup"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}