TechnitiumSoftware/DnsServer · error · DnsServerException
Failed to delete Cluster: the Cluster is not initialized.
Error message
Failed to delete Cluster: the Cluster is not initialized.
What it means
Thrown by DeleteCluster when ClusterInitialized is false. ClusterInitialized returns true only when _clusterNodes is non-null and contains at least one node (line 2199-2207). You cannot delete a cluster that was never created or has already been removed.
Source
Thrown at DnsServerCore/Cluster/ClusterManager.cs:672
RemoveAllClusterPrimaryZoneNSRecords(); //remove all existing NS records
AddClusterPrimaryZoneRecordsFor(selfPrimaryNode, nsTtl, aTtl, _dnsWebService.WebServiceTlsCertificate);
//update cluster catalog zone ACLs, TSIG key name and save zone file
UpdateClusterCatalogZoneOptions(clusterCatalogZoneInfo);
//finalize
_dnsWebService.DnsServer.ServerDomain = selfPrimaryNode.Name;
//save all changes
_dnsWebService.DnsServer.SaveConfigFile(true);
_dnsWebService.AuthManager.SaveConfigFile(true);
SaveConfigFile();
}
public void DeleteCluster(bool forceDelete)
{
if (!ClusterInitialized)
throw new DnsServerException("Failed to delete Cluster: the Cluster is not initialized.");
if (GetSelfNode().Type != ClusterNodeType.Primary)
throw new DnsServerException("Failed to delete Cluster: only a Primary node can delete the Cluster.");
if (!forceDelete && (_clusterNodes.Count > 1))
throw new DnsServerException("Failed to delete Cluster: please remove all Secondary nodes before deleting the Cluster.");
DeleteAllClusterConfig();
}
public ClusterNode JoinCluster(int secondaryNodeId, Uri secondaryNodeUrl, IReadOnlyList<IPAddress> secondaryNodeIpAddresses, X509Certificate2 secondaryNodeCertificate)
{
if (!ClusterInitialized)
throw new DnsServerException("Failed to add Secondary node: the Cluster is not initialized.");
if (GetSelfNode().Type != ClusterNodeType.Primary)
throw new DnsServerException("Failed to add Secondary node: only a Primary node can add a Secondary node to the Cluster.");
View on GitHub (pinned to d0484b6c1e)
Solutions
- Check ClusterManager.ClusterInitialized before calling DeleteCluster.
- Confirm you are operating on the correct server instance that actually hosts the cluster Primary node.
- If the cluster was already deleted, no further action is needed.
Example fix
// before
_dnsWebService.ClusterManager.DeleteCluster(false);
// after
if (_dnsWebService.ClusterManager.ClusterInitialized)
_dnsWebService.ClusterManager.DeleteCluster(false); Defensive patterns
Strategy: validation
Validate before calling
if (!_dnsWebService.ClusterManager.ClusterInitialized)
return; // or inform the user no cluster exists
_dnsWebService.ClusterManager.DeleteCluster(false); Type guard
static bool CanDeleteCluster(ClusterManager cm) => cm.ClusterInitialized;
Try / catch
try
{
_dnsWebService.ClusterManager.DeleteCluster(false);
}
catch (DnsServerException ex) when (ex.Message.Contains("the Cluster is not initialized"))
{
// no cluster to delete — treat as no-op
} Prevention
- Check ClusterInitialized before calling DeleteCluster.
- Disable or hide the delete-cluster UI control when no cluster is active.
- Track cluster state in your orchestration layer to avoid double-delete calls.
When it happens
Trigger: DeleteCluster(forceDelete) is called on a server where _clusterNodes is null or empty — either no cluster was ever initialized, or a prior DeleteCluster already cleared the node list.
Common situations: Calling DeleteCluster twice (double-delete); calling it on a fresh server that was never clustered; calling it on a Secondary node that lost its config; UI allowing a delete button click when no cluster is active.
Related errors
- Failed to add Secondary node: the Cluster is not initialized
- Failed to ask Secondary node to leave: the Cluster is not in
- Failed to delete Secondary node: the Cluster is not initiali
- Failed to update Secondary node: the Cluster is not initiali
- Failed to transfer configuration: the Cluster is not initial
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/5f10742dd9c9e47e.
Report an issue: GitHub.