{"record":{"id":"a4cfe212bda8972e","repo":"TechnitiumSoftware/DnsServer","slug":"address-family-not-supported-addressfamily","errorCode":null,"errorMessage":"Address family not supported: {addressFamily}","messagePattern":"Address family not supported: (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"Apps/NxDomainOverrideApp/App.cs","lineNumber":236,"sourceCode":"            #region constructor\n\n            public Set(JsonElement jsonSet)\n            {\n                _name = jsonSet.GetProperty(\"name\").GetString();\n                _rdataAddresses = jsonSet.ReadArray<DnsResourceRecordData>(\"addresses\", delegate (string item)\n                {\n                    IPAddress address = IPAddress.Parse(item);\n\n                    switch (address.AddressFamily)\n                    {\n                        case AddressFamily.InterNetwork:\n                            return new DnsARecordData(address);\n\n                        case AddressFamily.InterNetworkV6:\n                            return new DnsAAAARecordData(address);\n\n                        default:\n                            throw new NotSupportedException(\"Address family not supported: \" + address.AddressFamily.ToString());\n                    }\n                });\n            }\n\n            #endregion\n\n            #region properties\n\n            public string Name\n            { get { return _name; } }\n\n            public DnsResourceRecordData[] RecordDataAddresses\n            { get { return _rdataAddresses; } }\n\n            #endregion\n        }\n    }\n}","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/Apps/NxDomainOverrideApp/App.cs#L218-L254","documentation":"Thrown by NxDomainOverrideApp when IPAddress.Parse returns an address whose AddressFamily is neither InterNetwork (IPv4) nor InterNetworkV6 (IPv6). The override only knows how to materialise A and AAAA records, so any other family hits the default branch and throws NotSupportedException. In practice this branch is extremely hard to reach because IPAddress.Parse almost always yields v4 or v6.","triggerScenarios":"An item in the NxDomainOverrideApp 'addresses' list parses to an address with a non-v4/v6 family. Realistically only triggers with exotic/legacy families produced by specialised parse paths, not by normal dotted or colon notation.","commonSituations":"Very rare; could occur with a misconfigured or future address format, or a custom IPAddress subclass. Most operators will never see this.","solutions":["Review the NxDomainOverrideApp 'addresses' entries and ensure each is a valid IPv4 dotted-quad or IPv6 hex string.","Remove any experimental or non-IP literals from the list.","If you genuinely need a non-A/AAAA family, you must extend the switch before the default branch."],"exampleFix":"// before\n\"addresses\": [\"10.0.0.1\", \"some-weird-value\"]\n// after\n\"addresses\": [\"10.0.0.1\", \"2001:db8::1\"]","handlingStrategy":"validation","validationCode":"foreach (string item in items)\n{\n    IPAddress address = IPAddress.Parse(item);\n    if (address.AddressFamily != AddressFamily.InterNetwork && address.AddressFamily != AddressFamily.InterNetworkV6)\n        throw new ConfigValidationException($\"NxDomainOverrideApp address '{item}' is not IPv4 or IPv6.\");\n}","typeGuard":"static bool IsIpv4OrIpv6(string? v) => v is not null && IPAddress.TryParse(v, out var a) && (a.AddressFamily == AddressFamily.InterNetwork || a.AddressFamily == AddressFamily.InterNetworkV6);","tryCatchPattern":null,"preventionTips":["Restrict override addresses to IPv4 dotted-quad or IPv6 hex forms.","Validate every list entry parses as InterNetwork/InterNetworkV6 before deploy.","Lint the NxDomainOverrideApp addresses list."],"tags":["config","nxdomain-override","ip-address","address-family","notsupported"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}