TechnitiumSoftware/DnsServer · error · DnsServerException

Cannot convert the zone '<currentZoneInfo.DisplayName>' from

Error message

Cannot convert the zone '<currentZoneInfo.DisplayName>' from <currentZoneInfo.TypeName> to <AuthZoneInfo.GetZoneTypeName(newType)> zone: not supported.

What it means

Thrown by ConvertZoneTypeTo in the Primary-zone branch's inner default (line 1455). A Primary zone can only be converted to Forwarder; any other target type (Stub, Secondary, SecondaryForwarder, Catalog, SecondaryCatalog, Unknown) is unsupported and hits this default.

Source

Thrown at DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs:1456

                throw new DnsServerException("No such zone was found: " + (zoneName.Length == 0 ? "." : zoneName));

            //validate conversion type
            if (currentZoneInfo.Type == newType)
                throw new DnsServerException("Cannot convert the zone '" + currentZoneInfo.DisplayName + "' from " + currentZoneInfo.TypeName + " to " + AuthZoneInfo.GetZoneTypeName(newType) + " zone: the zone is already of the same type.");

            switch (currentZoneInfo.Type)
            {
                case AuthZoneType.Primary:
                    switch (newType)
                    {
                        case AuthZoneType.Forwarder:
                            if (currentZoneInfo.ApexZone.DnssecStatus != AuthZoneDnssecStatus.Unsigned)
                                throw new DnsServerException("Cannot convert the zone '" + currentZoneInfo.DisplayName + "' from " + currentZoneInfo.TypeName + " to " + AuthZoneInfo.GetZoneTypeName(newType) + " zone: converting the zone will cause lose of DNSSEC private keys.");

                            break;

                        default:
                            throw new DnsServerException("Cannot convert the zone '" + currentZoneInfo.DisplayName + "' from " + currentZoneInfo.TypeName + " to " + AuthZoneInfo.GetZoneTypeName(newType) + " zone: not supported.");
                    }

                    break;

                case AuthZoneType.Secondary:
                case AuthZoneType.SecondaryForwarder:
                case AuthZoneType.SecondaryCatalog:
                    switch (newType)
                    {
                        case AuthZoneType.Primary:
                        case AuthZoneType.Forwarder:
                        case AuthZoneType.Catalog:
                            break;

                        default:
                            throw new DnsServerException("Cannot convert the zone '" + currentZoneInfo.DisplayName + "' from " + currentZoneInfo.TypeName + " to " + AuthZoneInfo.GetZoneTypeName(newType) + " zone: not supported.");
                    }

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Only request Primary -> Forwarder conversions for a Primary source zone.
  2. To get a Secondary copy, create a new Secondary zone that transfers from this Primary instead of converting in place.
  3. Restrict the conversion target dropdown based on the source zone type.
  4. Pre-validate the (currentType, newType) pair against the supported matrix.

Example fix

// before
manager.ConvertZoneTypeTo(zoneName, AuthZoneType.Secondary); // Primary source -> throws

// after
var info = manager.GetAuthZoneInfo(zoneName);
if (info.Type == AuthZoneType.Primary && newType != AuthZoneType.Forwarder)
    return BadRequest("Primary zones can only be converted to Forwarder.");
manager.ConvertZoneTypeTo(zoneName, newType);
Defensive patterns

Strategy: validation

Validate before calling

if (info.Type == AuthZoneType.Primary && newType != AuthZoneType.Forwarder)
    return BadRequest("Primary zones can only be converted to Forwarder.");

Try / catch

catch (DnsServerException ex) when (ex.Message.Contains("not supported")) { return BadRequest(ex.Message); }

Prevention

When it happens

Trigger: Calling ConvertZoneTypeTo(zoneName, newType) where the current zone is Primary and newType is anything other than AuthZoneType.Forwarder (and not Primary itself, which is caught earlier by the same-type guard).

Common situations: Asking to turn a Primary zone into a Secondary or Stub (the server cannot synthesize a transfer source). UI offering all target types for every source type.

Related errors


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