{"record":{"id":"bda5d73f00532ae8","repo":"TechnitiumSoftware/DnsServer","slug":"cannot-convert-the-zone-currentzoneinfo-displayn-bda5d7","errorCode":null,"errorMessage":"Cannot convert the zone '<currentZoneInfo.DisplayName>' from <currentZoneInfo.TypeName> to <AuthZoneInfo.GetZoneTypeName(newType)> zone: not supported.","messagePattern":"Cannot convert the zone '<currentZoneInfo\\.DisplayName>' from <currentZoneInfo\\.TypeName> to <AuthZoneInfo\\.GetZoneTypeName\\(newType\\)> zone: not supported\\.","errorType":"exception","errorClass":"DnsServerException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs","lineNumber":1456,"sourceCode":"                throw new DnsServerException(\"No such zone was found: \" + (zoneName.Length == 0 ? \".\" : zoneName));\n\n            //validate conversion type\n            if (currentZoneInfo.Type == newType)\n                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.\");\n\n            switch (currentZoneInfo.Type)\n            {\n                case AuthZoneType.Primary:\n                    switch (newType)\n                    {\n                        case AuthZoneType.Forwarder:\n                            if (currentZoneInfo.ApexZone.DnssecStatus != AuthZoneDnssecStatus.Unsigned)\n                                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.\");\n\n                            break;\n\n                        default:\n                            throw new DnsServerException(\"Cannot convert the zone '\" + currentZoneInfo.DisplayName + \"' from \" + currentZoneInfo.TypeName + \" to \" + AuthZoneInfo.GetZoneTypeName(newType) + \" zone: not supported.\");\n                    }\n\n                    break;\n\n                case AuthZoneType.Secondary:\n                case AuthZoneType.SecondaryForwarder:\n                case AuthZoneType.SecondaryCatalog:\n                    switch (newType)\n                    {\n                        case AuthZoneType.Primary:\n                        case AuthZoneType.Forwarder:\n                        case AuthZoneType.Catalog:\n                            break;\n\n                        default:\n                            throw new DnsServerException(\"Cannot convert the zone '\" + currentZoneInfo.DisplayName + \"' from \" + currentZoneInfo.TypeName + \" to \" + AuthZoneInfo.GetZoneTypeName(newType) + \" zone: not supported.\");\n                    }\n","sourceCodeStart":1438,"sourceCodeEnd":1474,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs#L1438-L1474","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Only request Primary -> Forwarder conversions for a Primary source zone.","To get a Secondary copy, create a new Secondary zone that transfers from this Primary instead of converting in place.","Restrict the conversion target dropdown based on the source zone type.","Pre-validate the (currentType, newType) pair against the supported matrix."],"exampleFix":"// before\nmanager.ConvertZoneTypeTo(zoneName, AuthZoneType.Secondary); // Primary source -> throws\n\n// after\nvar info = manager.GetAuthZoneInfo(zoneName);\nif (info.Type == AuthZoneType.Primary && newType != AuthZoneType.Forwarder)\n    return BadRequest(\"Primary zones can only be converted to Forwarder.\");\nmanager.ConvertZoneTypeTo(zoneName, newType);","handlingStrategy":"validation","validationCode":"if (info.Type == AuthZoneType.Primary && newType != AuthZoneType.Forwarder)\n    return BadRequest(\"Primary zones can only be converted to Forwarder.\");","typeGuard":null,"tryCatchPattern":"catch (DnsServerException ex) when (ex.Message.Contains(\"not supported\")) { return BadRequest(ex.Message); }","preventionTips":["Constrain target-type options by source type.","Document the supported conversion matrix.","Create a Secondary via the create API rather than converting a Primary."],"tags":["dns","zone-management","convert","unsupported-type"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}