{"record":{"id":"5f7a183cd6f03650","repo":"TechnitiumSoftware/DnsServer","slug":"failed-to-refresh-configuration-the-cluster-is-no","errorCode":null,"errorMessage":"Failed to refresh configuration: the Cluster is not initialized.","messagePattern":"Failed to refresh configuration: the Cluster is not initialized\\.","errorType":"exception","errorClass":"DnsServerException","httpStatus":null,"severity":"warning","filePath":"DnsServerCore/Cluster/ClusterManager.cs","lineNumber":1608,"sourceCode":"\n            //update cluster catalog zone's primary name server\n            clusterSecondaryCatalogZoneInfo.PrimaryNameServerAddresses = primaryNodeIpAddresses.Convert(delegate (IPAddress ipAddress) { return new NameServerAddress(primaryNodeUrl.Host, ipAddress); });\n\n            //save all changes\n            _dnsWebService.DnsServer.AuthZoneManager.SaveZoneFile(clusterSecondaryCatalogZoneInfo.Name);\n            SaveConfigFile();\n\n            //trigger config and zone refresh\n            TriggerRefreshForConfig(CONFIG_REFRESH_TIMER_INTERVAL);\n\n            return primaryNode;\n        }\n\n        public void TriggerRefreshForConfig(IReadOnlyCollection<string> configRefreshIncludeZones = null)\n        {\n            //do validation\n            if (!ClusterInitialized)\n                throw new DnsServerException(\"Failed to refresh configuration: the Cluster is not initialized.\");\n\n            ClusterNode primaryNode = GetPrimaryNode();\n\n            if (primaryNode.State == ClusterNodeState.Self)\n                throw new DnsServerException(\"Failed to refresh configuration: only Secondary nodes can sync configuration from Primary nodes.\");\n\n            TriggerRefreshForConfig(CONFIG_REFRESH_TIMER_INTERVAL, configRefreshIncludeZones);\n        }\n\n        public void TriggerResyncForConfig()\n        {\n            //do validation\n            if (!ClusterInitialized)\n                throw new DnsServerException(\"Failed to resync configuration: the Cluster is not initialized.\");\n\n            ClusterNode primaryNode = GetPrimaryNode();\n\n            if (primaryNode.State == ClusterNodeState.Self)","sourceCodeStart":1590,"sourceCodeEnd":1626,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Cluster/ClusterManager.cs#L1590-L1626","documentation":"Thrown at the top of the public TriggerRefreshForConfig(IReadOnlyCollection<string>) overload when ClusterInitialized is false. Config refresh pulls configuration from a primary node, which requires an active cluster; on a standalone server there is nothing to refresh from.","triggerScenarios":"Calling TriggerRefreshForConfig (e.g. from a 'refresh config now' button) on a node that is not part of any cluster.","commonSituations":"UI/API 'refresh configuration' invoked on a primary-only standalone server; the node had left the cluster but the action was still available; cluster config lost between page load and click.","solutions":["Gate the call on ClusterInitialized and surface 'not clustered' to the user instead of invoking.","If clustering was expected, restore/rejoin the cluster before refreshing.","Disable the refresh-config control in the UI whenever ClusterInitialized is false."],"exampleFix":"// before\nclusterManager.TriggerRefreshForConfig(includeZones);\n\n// after\nif (!clusterManager.ClusterInitialized)\n    return BadRequest(\"Not clustered; nothing to refresh.\");\nclusterManager.TriggerRefreshForConfig(includeZones);","handlingStrategy":"validation","validationCode":"if (!clusterManager.ClusterInitialized)\n    return BadRequest(\"Not clustered; nothing to refresh.\");\nclusterManager.TriggerRefreshForConfig(includeZones);","typeGuard":"static bool CanRefreshConfig(ClusterManager cm) => cm.ClusterInitialized;","tryCatchPattern":"try { clusterManager.TriggerRefreshForConfig(includeZones); }\ncatch (DnsServerException ex) when (ex.Message.Contains(\"not initialized\"))\n{ /* not clustered; no-op */ }","preventionTips":["Gate the refresh action on ClusterInitialized.","Hide the refresh control on standalone nodes.","Make periodic refresh jobs self-skip when not clustered."],"tags":["cluster","precondition","config-refresh","technitium","state-guard"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}