{"record":{"id":"529016a8ea9360cf","repo":"TechnitiumSoftware/DnsServer","slug":"network-group-map-contains-an-invalid-network-addr-529016","errorCode":null,"errorMessage":"Network group map contains an invalid network address: {network}","messagePattern":"Network group map contains an invalid network address: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Apps/Dns64App/App.cs","lineNumber":78,"sourceCode":"        #endregion\n\n        #region public\n\n        public Task InitializeAsync(IDnsServer dnsServer, string config)\n        {\n            _dnsServer = dnsServer;\n\n            using JsonDocument jsonDocument = JsonDocument.Parse(config, _jsonParseOptions);\n            JsonElement jsonConfig = jsonDocument.RootElement;\n\n            _appPreference = Convert.ToByte(jsonConfig.GetPropertyValue(\"appPreference\", 30));\n\n            _enableDns64 = jsonConfig.GetProperty(\"enableDns64\").GetBoolean();\n\n            _networkGroupMap = jsonConfig.ReadObjectAsMap(\"networkGroupMap\", delegate (string network, JsonElement group)\n            {\n                if (!NetworkAddress.TryParse(network, out NetworkAddress networkAddress))\n                    throw new InvalidOperationException(\"Network group map contains an invalid network address: \" + network);\n\n                return new Tuple<NetworkAddress, string>(networkAddress, group.GetString());\n            });\n\n            _groups = jsonConfig.ReadArrayAsMap(\"groups\", delegate (JsonElement jsonGroup)\n            {\n                Group group = new Group(jsonGroup);\n                return new Tuple<string, Group>(group.Name, group);\n            });\n\n            return Task.CompletedTask;\n        }\n\n        public async Task<DnsDatagram> PostProcessAsync(DnsDatagram request, IPEndPoint remoteEP, DnsTransportProtocol protocol, DnsDatagram response)\n        {\n            if (!_enableDns64)\n                return response;\n","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/Apps/Dns64App/App.cs#L60-L96","documentation":"Thrown while parsing the Dns64App 'networkGroupMap' JSON object. Each key is parsed with NetworkAddress.TryParse expecting a CIDR network; on failure InvalidOperationException is raised during app initialization (the Dns64 app uses InvalidOperationException, like the blocking app, for this check).","triggerScenarios":"Calling the Dns64App initializer with a 'networkGroupMap' key that NetworkAddress.TryParse rejects: a hostname, a bare IP without prefix, a malformed CIDR, or an endpoint with a port.","commonSituations":"Using a single IPv6 client address without '/128'; pasting '2001:db8::1' instead of the subnet '2001:db8::/64'; CIDR typo; DNS64 NAT64 client prefix mistakenly placed in the network map.","solutions":["Correct the 'networkGroupMap' key in dnsApp.config to valid CIDR notation (e.g. '2001:db8::/64', '192.168.0.0/16').","Use '/128' or '/32' for a single host and never include a ':port'.","Put the NAT64 translation prefix in 'dns64PrefixMap', not in 'networkGroupMap'."],"exampleFix":"// before (dnsApp.config)\n\"networkGroupMap\": { \"2001:db8::1\": \"groupA\" }\n// after\n\"networkGroupMap\": { \"2001:db8::/64\": \"groupA\" }","handlingStrategy":"validation","validationCode":"foreach (string key in networkGroupMapKeys)\n{\n    if (!NetworkAddress.TryParse(key, out NetworkAddress _))\n        throw new FormatException($\"Dns64 '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 notation with explicit prefix length in Dns64 network maps.","Keep the NAT64 prefix in dns64PrefixMap, not networkGroupMap.","Use '/128' for single IPv6 hosts."],"tags":["csharp","config","json","cidr","network","ipv6","dns64","technitium"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}