TechnitiumSoftware/DnsServer · error · InvalidOperationException

Local end point group map contains an invalid end point: {lo

Error message

Local end point group map contains an invalid end point: {localEP}

What it means

Thrown while parsing the AdvancedBlockingApp 'localEndPointGroupMap' JSON object in the app config. Each map key is passed to EndPointExtensions.TryParse (expects an IP:port endpoint like '192.168.1.5:53'); when parsing fails the key is rejected as invalid. The error is an InvalidOperationException raised during app initialization, so the app fails to load the config.

Source

Thrown at Apps/AdvancedBlockingApp/App.cs:370

                throw new InvalidOperationException();

            Directory.CreateDirectory(Path.Combine(_dnsServer.ApplicationFolder, "blocklists"));
            using JsonDocument jsonDocument = JsonDocument.Parse(config, _jsonParseOptions);
            JsonElement jsonConfig = jsonDocument.RootElement;

            _enableBlocking = jsonConfig.GetPropertyValue("enableBlocking", true);
            _blockingAnswerTtl = jsonConfig.GetPropertyValue("blockingAnswerTtl", 30u);
            _blockListUrlUpdateIntervalHours = jsonConfig.GetPropertyValue("blockListUrlUpdateIntervalHours", 24);
            _blockListUrlUpdateIntervalMinutes = jsonConfig.GetPropertyValue("blockListUrlUpdateIntervalMinutes", 0);

            _soaRecord = new DnsSOARecordData(_dnsServer.ServerDomain, _dnsServer.ResponsiblePerson.Address, 1, 14400, 3600, 604800, _blockingAnswerTtl);
            _nsRecord = new DnsNSRecordData(_dnsServer.ServerDomain);

            if (jsonConfig.TryReadObjectAsMap("localEndPointGroupMap",
                delegate (string localEP, JsonElement jsonGroup)
                {
                    if (!EndPointExtensions.TryParse(localEP, out EndPoint ep))
                        throw new InvalidOperationException("Local end point group map contains an invalid end point: " + localEP);

                    return new Tuple<EndPoint, string>(ep, jsonGroup.GetString() ?? "");
                },
                out Dictionary<EndPoint, string>? localEndPointGroupMap))
            {
                _localEndPointGroupMap = localEndPointGroupMap;
            }

            _networkGroupMap = jsonConfig.ReadObjectAsMap("networkGroupMap", delegate (string network, JsonElement jsonGroup)
            {
                if (!NetworkAddress.TryParse(network, out NetworkAddress networkAddress))
                    throw new InvalidOperationException("Network group map contains an invalid network address: " + network);

                return new Tuple<NetworkAddress, string>(networkAddress, jsonGroup.GetString() ?? "");
            });

            {
                Dictionary<Uri, BlockList> allAllowListZones = new Dictionary<Uri, BlockList>(0);

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Open dnsApp.config and fix the offending 'localEndPointGroupMap' key so it is a valid IP endpoint with a port (e.g. change '192.168.1.10' to '192.168.1.10:53').
  2. Verify the key matches the client's local source endpoint as the server observes it; for IPv6 use bracketed form like '[fe80::1]:53'.
  3. If you intended a subnet-based group, move that entry into 'networkGroupMap' instead, which accepts CIDR notation.

Example fix

// before (dnsApp.config)
"localEndPointGroupMap": { "192.168.1.10": "groupA" }
// after
"localEndPointGroupMap": { "192.168.1.10:53": "groupA" }
Defensive patterns

Strategy: validation

Validate before calling

// Validate every 'localEndPointGroupMap' key is a parseable endpoint before applying config.
foreach (string key in localEndPointGroupMapKeys)
{
    if (!EndPointExtensions.TryParse(key, out EndPoint _))
        throw new FormatException($"'localEndPointGroupMap' key '{key}' is not a valid IP:port endpoint. Expected e.g. '192.168.1.10:53'.");
}

Type guard

static bool IsValidLocalEndPointKey(string key) => EndPointExtensions.TryParse(key, out EndPoint _);

Prevention

When it happens

Trigger: Calling the AdvancedBlockingApp initializer with a 'localEndPointGroupMap' whose key string is not a parseable endpoint (e.g. a bare IP without a port, a hostname, '0.0.0.0', or a malformed address like '999.1.1.1:53'). EndPointExtensions.TryParse returns false for that key.

Common situations: Copying a subnet value from 'networkGroupMap' into 'localEndPointGroupMap' (CIDR notation like '10.0.0.0/24' is rejected because endpoints require a port); forgetting the ':53' port; pasting a hostname instead of an IP.

Related errors


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