{"record":{"id":"1993e5a06bebaada","repo":"TechnitiumSoftware/DnsServer","slug":"network-group-map-contains-an-invalid-network-addr-1993e5","errorCode":null,"errorMessage":"Network group map contains an invalid network address: {network}","messagePattern":"Network group map contains an invalid network address: (.+?)","errorType":"exception","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"Apps/AdvancedForwardingApp/App.cs","lineNumber":147,"sourceCode":"                return new Tuple<string, ConfigProxyServer>(proxyServer.Name, proxyServer);\n            }, out Dictionary<string, ConfigProxyServer>? configProxyServers))\n                _configProxyServers = configProxyServers;\n            else\n                _configProxyServers = null;\n\n            if (jsonConfig.TryReadArrayAsMap(\"forwarders\", delegate (JsonElement jsonForwarder)\n            {\n                ConfigForwarder forwarder = new ConfigForwarder(jsonForwarder, _configProxyServers);\n                return new Tuple<string, ConfigForwarder>(forwarder.Name, forwarder);\n            }, out Dictionary<string, ConfigForwarder>? configForwarders))\n                _configForwarders = configForwarders;\n            else\n                _configForwarders = null;\n\n            _networkGroupMap = jsonConfig.ReadObjectAsMap(\"networkGroupMap\", delegate (string network, JsonElement jsonGroup)\n            {\n                if (!NetworkAddress.TryParse(network, out NetworkAddress networkAddress))\n                    throw new FormatException(\"Network group map contains an invalid network address: \" + network);\n\n                return new Tuple<NetworkAddress, string>(networkAddress, jsonGroup.ToString());\n            });\n\n            if (jsonConfig.TryReadArrayAsMap(\"groups\", ReadGroup, out Dictionary<string, Group>? groups) && (groups is not null))\n            {\n                if (_groups is not null)\n                {\n                    foreach (KeyValuePair<string, Group> group in _groups)\n                    {\n                        if (!groups.ContainsKey(group.Key))\n                            group.Value.Dispose();\n                    }\n                }\n\n                _groups = groups;\n            }\n            else","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/Apps/AdvancedForwardingApp/App.cs#L129-L165","documentation":"Thrown while parsing the AdvancedForwardingApp 'networkGroupMap' JSON object. Each key is parsed with NetworkAddress.TryParse expecting a CIDR network; on failure a FormatException is raised during app initialization. Note this app uses FormatException, unlike the InvalidOperationException used by the blocking/Dns64 apps for the same check.","triggerScenarios":"Calling the AdvancedForwardingApp initializer with a 'networkGroupMap' key that is not a valid CIDR network address (hostname, bare IP without prefix, malformed CIDR like '10/24', endpoint with a port).","commonSituations":"Entering a single client IP without '/32'; pasting an endpoint '10.0.0.1:53'; CIDR typo; mixing DNS zone names into the network map.","solutions":["Fix the 'networkGroupMap' key in dnsApp.config to valid CIDR notation (e.g. '10.0.0.0/24', '::/0').","Use '/32' or '/128' for a single host and remove any ':port' suffix.","Validate all network map keys with a CIDR regex/linter before saving the config."],"exampleFix":"// before (dnsApp.config)\n\"networkGroupMap\": { \"10.0.0.1:53\": \"groupA\" }\n// after\n\"networkGroupMap\": { \"10.0.0.0/24\": \"groupA\" }","handlingStrategy":"validation","validationCode":"foreach (string key in networkGroupMapKeys)\n{\n    if (!NetworkAddress.TryParse(key, out NetworkAddress _))\n        throw new FormatException($\"'networkGroupMap' key '{key}' is not a valid CIDR network.\");\n}","typeGuard":"static bool IsValidCidrKey(string key) => NetworkAddress.TryParse(key, out NetworkAddress _);","tryCatchPattern":null,"preventionTips":["Use CIDR with an explicit prefix length; '/32' for single hosts.","Never put an endpoint (with ':port') in networkGroupMap.","Validate config keys before saving via the web UI or a script."],"tags":["csharp","config","json","cidr","network","technitium","advanced-forwarding-app"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}