TechnitiumSoftware/DnsServer · warning · DnsServerException
Failed to resync configuration: only Secondary nodes can syn
Error message
Failed to resync configuration: only Secondary nodes can sync configuration from Primary nodes.
What it means
Thrown by TriggerResyncForConfig when GetPrimaryNode().State == ClusterNodeState.Self: this server is the primary. Like the refresh variant (192), resync pulls config from an upstream primary, which a primary node does not have. The guard stops the primary from attempting to resync from itself.
Source
Thrown at DnsServerCore/Cluster/ClusterManager.cs:1627
ClusterNode primaryNode = GetPrimaryNode();
if (primaryNode.State == ClusterNodeState.Self)
throw new DnsServerException("Failed to refresh configuration: only Secondary nodes can sync configuration from Primary nodes.");
TriggerRefreshForConfig(CONFIG_REFRESH_TIMER_INTERVAL, configRefreshIncludeZones);
}
public void TriggerResyncForConfig()
{
//do validation
if (!ClusterInitialized)
throw new DnsServerException("Failed to resync configuration: the Cluster is not initialized.");
ClusterNode primaryNode = GetPrimaryNode();
if (primaryNode.State == ClusterNodeState.Self)
throw new DnsServerException("Failed to resync configuration: only Secondary nodes can sync configuration from Primary nodes.");
_configLastSynced = DateTime.UnixEpoch; //to ensure complete config resync
//trigger immediate config refresh
TriggerRefreshForConfig(0);
}
private void TriggerRefreshForConfig(int refreshInterval, IReadOnlyCollection<string> configRefreshIncludeZones = null)
{
_configRefreshLock.Wait();
try
{
if (configRefreshIncludeZones is not null)
{
if (_configRefreshIncludeZones is null)
_configRefreshIncludeZones = configRefreshIncludeZones;
else
_configRefreshIncludeZones = [.. _configRefreshIncludeZones, .. configRefreshIncludeZones];View on GitHub (pinned to d0484b6c1e)
Solutions
- Call TriggerResyncForConfig only from Secondary nodes.
- Branch shared automation on GetPrimaryNode().State and skip resync on the primary.
- Disable the resync action in the UI when the current node is the primary.
Example fix
// before
clusterManager.TriggerResyncForConfig();
// after
if (clusterManager.GetPrimaryNode().State == ClusterNodeState.Self)
return Ok("Primary node; nothing to resync.");
clusterManager.TriggerResyncForConfig(); Defensive patterns
Strategy: validation
Validate before calling
if (clusterManager.GetPrimaryNode().State == ClusterNodeState.Self)
return Ok("Primary node; nothing to resync.");
clusterManager.TriggerResyncForConfig(); Type guard
static bool CanResyncFromPrimary(ClusterManager cm)
=> cm.ClusterInitialized && cm.GetPrimaryNode().State != ClusterNodeState.Self; Try / catch
try { clusterManager.TriggerResyncForConfig(); }
catch (DnsServerException ex) when (ex.Message.Contains("only Secondary nodes can sync"))
{ /* primary node; no-op */ } Prevention
- Call resync only from secondaries.
- Branch automation on node role to skip resync on the primary.
- Resync is heavyweight (full pull) — confirm the node is a secondary first.
When it happens
Trigger: Calling TriggerResyncForConfig on the primary node of the cluster.
Common situations: Logged into the primary when clicking 'resync config from primary'; automation runs the resync job on all cluster members including the primary.
Related errors
- Failed to leave Cluster: a Primary self node cannot leave th
- Failed to refresh configuration: only Secondary nodes can sy
- Failed to leave Cluster: only Secondary nodes can leave the
- Failed to update Primary node: the specified node is the sel
- Failed to resync configuration: the Cluster is not initializ
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/1e20ea031a758fce.
Report an issue: GitHub.