{"record":{"id":"79f0e42e04d1c0a6","repo":"TechnitiumSoftware/DnsServer","slug":"failed-to-update-secondary-node-the-cluster-is-no","errorCode":null,"errorMessage":"Failed to update Secondary node: the Cluster is not initialized.","messagePattern":"Failed to update Secondary node: the Cluster is not initialized\\.","errorType":"exception","errorClass":"DnsServerException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Cluster/ClusterManager.cs","lineNumber":819,"sourceCode":"            //update cluster catalog zone ACLs and save zone file\n            UpdateClusterCatalogZoneOptions();\n\n            //save all changes\n            SaveConfigFile();\n\n            //notify all secondary nodes\n            TriggerNotifyAllSecondaryNodes();\n\n            //trigger NS and SOA update for member zones\n            TriggerRecordUpdateForClusterCatalogMemberZones();\n\n            return secondaryNode;\n        }\n\n        public ClusterNode UpdateSecondaryNode(int secondaryNodeId, Uri secondaryNodeUrl, IReadOnlyList<IPAddress> secondaryNodeIpAddresses, X509Certificate2 secondaryNodeCertificate)\n        {\n            if (!ClusterInitialized)\n                throw new DnsServerException(\"Failed to update Secondary node: the Cluster is not initialized.\");\n\n            if (GetSelfNode().Type != ClusterNodeType.Primary)\n                throw new DnsServerException(\"Failed to update Secondary node: only a Primary node can update a Secondary node's details in the Cluster.\");\n\n            IReadOnlyDictionary<int, ClusterNode> clusterNodes = _clusterNodes;\n\n            if (!clusterNodes.TryGetValue(secondaryNodeId, out ClusterNode secondaryNode))\n                throw new DnsServerException(\"Failed to update Secondary node: the specified node does not exist in the Cluster.\");\n\n            if (secondaryNode.Type != ClusterNodeType.Secondary)\n                throw new DnsServerException(\"Failed to update Secondary node: the specified node to update must be a Secondary node.\");\n\n            //validate for duplicate names\n            foreach (KeyValuePair<int, ClusterNode> clusterNode in clusterNodes)\n            {\n                if (clusterNode.Key == secondaryNodeId)\n                    continue; //skip self\n","sourceCodeStart":801,"sourceCodeEnd":837,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Cluster/ClusterManager.cs#L801-L837","documentation":"UpdateSecondaryNode refuses to run because the local node has not initialized or joined a cluster (ClusterInitialized is false). Every Secondary-node management call requires an active cluster context on the Primary.","triggerScenarios":"Calling UpdateSecondaryNode before CreateCluster/InitializeAndJoinClusterAsync completed; calling it on a standalone non-clustered server; calling after the cluster was left or reset.","commonSituations":"Misrouted API call hitting a node that is not the cluster Primary; stale config pointing automation at the wrong server; an earlier cluster initialization that failed silently.","solutions":["Ensure the server is the cluster Primary and ClusterInitialized is true before calling","Point the call at the Primary node's API endpoint, not a Secondary or standalone server","Re-run cluster initialization if it failed earlier"],"exampleFix":"// before\nclusterManager.UpdateSecondaryNode(id, url, ips, cert);\n\n// after\nif (!clusterManager.ClusterInitialized)\n    throw new InvalidOperationException(\"Cluster not initialized; cannot update Secondary node.\");\nclusterManager.UpdateSecondaryNode(id, url, ips, cert);","handlingStrategy":"validation","validationCode":"if (!clusterManager.ClusterInitialized)\n    return BadRequest(\"Cluster is not initialized on this node.\");\nclusterManager.UpdateSecondaryNode(id, url, ips, cert);","typeGuard":null,"tryCatchPattern":"catch (DnsServerException ex) when (ex.Message.Contains(\"Cluster is not initialized\"))\n{ /* route the client to the Primary node or init the cluster */ }","preventionTips":["Gate every cluster-management endpoint on clusterManager.ClusterInitialized","Expose cluster state so clients can verify the target is the Primary before calling"],"tags":["cluster","lifecycle","validation","dns-server"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}