TechnitiumSoftware/DnsServer · critical · FileNotFoundException

MaxMind Country file is missing!

Error message

MaxMind Country file is missing!

What it means

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.

Source

Thrown at Apps/GeoContinentApp/MaxMind.cs:49

        static MaxMind? _maxMind;

        readonly DatabaseReader _mmCountryReader;
        readonly DatabaseReader? _mmIspReader;
        readonly DatabaseReader? _mmAsnReader;

        #endregion

        #region constructor

        private MaxMind(IDnsServer dnsServer)
        {
            string mmCountryFile = Path.Combine(dnsServer.ApplicationFolder, "GeoIP2-Country.mmdb");

            if (!File.Exists(mmCountryFile))
                mmCountryFile = Path.Combine(dnsServer.ApplicationFolder, "GeoLite2-Country.mmdb");

            if (!File.Exists(mmCountryFile))
                throw new FileNotFoundException("MaxMind Country file is missing!");

            _mmCountryReader = new DatabaseReader(mmCountryFile);

            string mmIspFile = Path.Combine(dnsServer.ApplicationFolder, "GeoIP2-ISP.mmdb");
            if (File.Exists(mmIspFile))
            {
                _mmIspReader = new DatabaseReader(mmIspFile);
                return;
            }

            string mmAsnFile = Path.Combine(dnsServer.ApplicationFolder, "GeoLite2-ASN.mmdb");
            if (File.Exists(mmAsnFile))
                _mmAsnReader = new DatabaseReader(mmAsnFile);
        }

        #endregion

        #region IDisposable

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Sign up at MaxMind and download GeoLite2-Country.mmdb (free) or GeoIP2-Country.mmdb (paid).
  2. Copy the file into the DNS server ApplicationFolder (the same folder returned by IDnsServer.ApplicationFolder).
  3. Restart the DnsServer process so the MaxMind constructor finds the file and initialises the readers.
Defensive patterns

Strategy: validation

Validate before calling

string folder = dnsServer.ApplicationFolder;
string[] candidates = { Path.Combine(folder,"GeoIP2-Country.mmdb"), Path.Combine(folder,"GeoLite2-Country.mmdb") };
if (!candidates.Any(File.Exists))
    throw new ConfigValidationException("GeoContinentApp requires GeoIP2-Country.mmdb or GeoLite2-Country.mmdb in: " + folder);

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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