TechnitiumSoftware/DnsServer · error · NotSupportedException

Address family not supported: {addressFamily}

Error message

Address family not supported: {addressFamily}

What it means

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.

Source

Thrown at Apps/NxDomainOverrideApp/App.cs:236

            #region constructor

            public Set(JsonElement jsonSet)
            {
                _name = jsonSet.GetProperty("name").GetString();
                _rdataAddresses = jsonSet.ReadArray<DnsResourceRecordData>("addresses", delegate (string item)
                {
                    IPAddress address = IPAddress.Parse(item);

                    switch (address.AddressFamily)
                    {
                        case AddressFamily.InterNetwork:
                            return new DnsARecordData(address);

                        case AddressFamily.InterNetworkV6:
                            return new DnsAAAARecordData(address);

                        default:
                            throw new NotSupportedException("Address family not supported: " + address.AddressFamily.ToString());
                    }
                });
            }

            #endregion

            #region properties

            public string Name
            { get { return _name; } }

            public DnsResourceRecordData[] RecordDataAddresses
            { get { return _rdataAddresses; } }

            #endregion
        }
    }
}

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Review the NxDomainOverrideApp 'addresses' entries and ensure each is a valid IPv4 dotted-quad or IPv6 hex string.
  2. Remove any experimental or non-IP literals from the list.
  3. If you genuinely need a non-A/AAAA family, you must extend the switch before the default branch.

Example fix

// before
"addresses": ["10.0.0.1", "some-weird-value"]
// after
"addresses": ["10.0.0.1", "2001:db8::1"]
Defensive patterns

Strategy: validation

Validate before calling

foreach (string item in items)
{
    IPAddress address = IPAddress.Parse(item);
    if (address.AddressFamily != AddressFamily.InterNetwork && address.AddressFamily != AddressFamily.InterNetworkV6)
        throw new ConfigValidationException($"NxDomainOverrideApp address '{item}' is not IPv4 or IPv6.");
}

Type guard

static bool IsIpv4OrIpv6(string? v) => v is not null && IPAddress.TryParse(v, out var a) && (a.AddressFamily == AddressFamily.InterNetwork || a.AddressFamily == AddressFamily.InterNetworkV6);

Prevention

When it happens

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

Common situations: Very rare; could occur with a misconfigured or future address format, or a custom IPAddress subclass. Most operators will never see this.

Related errors


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