{"record":{"id":"ba245be49e3210fd","repo":"TechnitiumSoftware/DnsServer","slug":"failed-to-update-self-node-url-the-node-s-domain","errorCode":null,"errorMessage":"Failed to update self node URL: the node's domain name already exists in the Cluster. Please try again after changing the DNS Server's domain name.","messagePattern":"Failed to update self node URL: the node's domain name already exists in the Cluster\\. Please try again after changing the DNS Server's domain name\\.","errorType":"exception","errorClass":"DnsServerException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Cluster/ClusterManager.cs","lineNumber":2150,"sourceCode":"                    TriggerClusterUpdateForSecondaryNodeChanges();\n                    break;\n            }\n\n            return selfNode;\n        }\n\n        public void UpdateSelfNodeUrlAndCertificate()\n        {\n            ClusterNode selfNode = GetSelfNode();\n\n            //validation\n            foreach (KeyValuePair<int, ClusterNode> clusterNode in _clusterNodes)\n            {\n                if (clusterNode.Key == selfNode.Id)\n                    continue; //skip self\n\n                if (clusterNode.Value.Name.Equals(_dnsWebService.DnsServer.ServerDomain, StringComparison.OrdinalIgnoreCase))\n                    throw new DnsServerException(\"Failed to update self node URL: the node's domain name already exists in the Cluster. Please try again after changing the DNS Server's domain name.\");\n            }\n\n            switch (selfNode.Type)\n            {\n                case ClusterNodeType.Primary:\n                    //find existing record TTL values\n                    FindExistingRecordTtlValues(out uint nsTtl, out uint aTtl);\n\n                    //update cluster zone to remove current self node records\n                    RemoveClusterPrimaryZoneRecordsFor(selfNode);\n\n                    //update self node\n                    selfNode.UpdateSelfNodeUrl();\n\n                    //update cluster zone to add updated self node records\n                    AddClusterPrimaryZoneRecordsFor(selfNode, nsTtl, aTtl, _dnsWebService.WebServiceTlsCertificate);\n\n                    //save all changes","sourceCodeStart":2132,"sourceCodeEnd":2168,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Cluster/ClusterManager.cs#L2132-L2168","documentation":"Thrown by ClusterManager.UpdateSelfNodeUrlAndCertificate() when the self node's domain name (DnsServer.ServerDomain) collides with the host (Name) of another node already in the cluster. The method regenerates the self node URL/certificate after a domain change and forbids duplicate hostnames so the cluster DNS zone records (NS/A) do not clash. It is a DnsServerException, so it surfaces as a user-facing web API error rather than a raw exception.","triggerScenarios":"Changing the DNS Server domain name to a value that equals another cluster node's hostname, then triggering UpdateSelfNodeUrlAndCertificate (e.g. via the settings API / TLS cert refresh). The loop at ClusterManager.cs:2144 skips only the self node's own Id and compares every other node's Name against ServerDomain.","commonSituations":"Renaming two clustered DNS servers to the same domain; restoring a config backup whose ServerDomain matches a peer; a secondary node joining with the primary's domain name; split-brain where both nodes were configured with an identical FQDN.","solutions":["Pick a unique DNS Server domain name that does not match any other cluster node's host, then retry.","If the colliding node is decommissioned/stale, remove it from the cluster first (delete secondary node), then retry the URL update.","Rename the OTHER node's domain instead of the self node so the self node keeps its identity.","List all cluster node Names beforehand to confirm the intended value is free."],"exampleFix":"// before: ServerDomain = 'dns1.example.com' while another node already uses dns1.example.com\n_dnsWebService.DnsServer.ServerDomain = \"dns1.example.com\"; // collides\n_clusterManager.UpdateSelfNodeUrlAndCertificate(); // throws [200]\n\n// after: choose a distinct hostname per node\n_dnsWebService.DnsServer.ServerDomain = \"dns2.example.com\"; // unique in cluster\n_clusterManager.UpdateSelfNodeUrlAndCertificate(); // ok","handlingStrategy":"try-catch","validationCode":"// Before UpdateSelfNodeUrlAndCertificate(): ensure no other node uses the intended domain\nstring newDomain = _dnsWebService.DnsServer.ServerDomain;\nvar self = _clusterManager.GetSelfNode();\nbool collision = _clusterNodes.Any(kv => kv.Key != self.Id\n    && kv.Value.Name.Equals(newDomain, StringComparison.OrdinalIgnoreCase));\nif (collision)\n    throw new InvalidOperationException(\"Domain '\" + newDomain + \"' is already used by another cluster node.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    _clusterManager.UpdateSelfNodeUrlAndCertificate();\n}\ncatch (DnsServerException ex) when (ex.Message.Contains(\"domain name already exists in the Cluster\"))\n{\n    // surface to user: prompt for a unique domain name\n    logger.LogWarning(\"Self node URL update rejected: duplicate domain. {Message}\", ex.Message);\n    return Problem(ex.Message);\n}","preventionTips":["Maintain a unique hostname per cluster node; never reuse a peer's domain.","Before renaming a node, check every other node's Name property.","When restoring config backups, verify the ServerDomain does not collide with live peers."],"tags":["cluster","configuration","duplicate-name","dns-server"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}