TechnitiumSoftware/DnsServer · warning · DnsServerException

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

Error message

Cannot convert the zone '<currentZoneInfo.DisplayName>' from <currentZoneInfo.TypeName> to <AuthZoneInfo.GetZoneTypeName(newType)> zone: the zone is already of the same type.

What it means

Thrown by ConvertZoneTypeTo when currentZoneInfo.Type equals newType, i.e. the requested conversion is a no-op. The guard at line 1441 short-circuits before any structural switch because converting a zone to its own type is meaningless and would otherwise churn records.

Source

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

            //load and init zone
            LoadAndInitZone(zoneInfo, newRecords);

            //save zone file
            SaveZoneFile(zoneInfo.Name);

            return zoneInfo;
        }

        public AuthZoneInfo ConvertZoneTypeTo(string zoneName, AuthZoneType newType)
        {
            AuthZoneInfo currentZoneInfo = GetAuthZoneInfo(zoneName);
            if (currentZoneInfo is null)
                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;

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Skip the call when currentZoneInfo.Type == newType.
  2. Initialize the conversion target selector to a different type than the current one.
  3. Refresh zone metadata so the decision is based on live state.
  4. Catch and treat as a no-op warning rather than an error in orchestration scripts.

Example fix

// before
manager.ConvertZoneTypeTo(zoneName, desiredType); // throws if same type

// after
var info = manager.GetAuthZoneInfo(zoneName);
if (info.Type == desiredType)
    return; // nothing to do
manager.ConvertZoneTypeTo(zoneName, desiredType);
Defensive patterns

Strategy: validation

Validate before calling

var info = manager.GetAuthZoneInfo(zoneName);
if (info.Type == newType) return; // no-op, skip convert

Try / catch

catch (DnsServerException ex) when (ex.Message.Contains("already of the same type")) { /* treat as success/no-op */ }

Prevention

When it happens

Trigger: Calling ConvertZoneTypeTo with a newType that is identical to the zone's current AuthZoneType. For example calling ConvertZoneTypeTo("example.com", AuthZoneType.Primary) on a zone that is already Primary.

Common situations: UI defaulting the target-type selector to the current type. Scripted bulk-convert that doesn't skip already-matching zones. Stale cached zone info used to decide the conversion target.

Related errors


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