TechnitiumSoftware/DnsServer · warning · DnsServerException

Failed to resync configuration: the Cluster is not initializ

Error message

Failed to resync configuration: the Cluster is not initialized.

What it means

Thrown at the top of TriggerResyncForConfig when ClusterInitialized is false. Resync forces a complete config pull (it resets _configLastSynced to UnixEpoch) from the primary, so it needs an active cluster; a standalone node cannot resync.

Source

Thrown at DnsServerCore/Cluster/ClusterManager.cs:1622

        public void TriggerRefreshForConfig(IReadOnlyCollection<string> configRefreshIncludeZones = null)
        {
            //do validation
            if (!ClusterInitialized)
                throw new DnsServerException("Failed to refresh configuration: the Cluster is not initialized.");

            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)

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Guard with ClusterInitialized; report 'not clustered' instead of calling resync.
  2. If clustering is intended, run JoinClusterAsync first to establish the primary relationship, then resync.
  3. Make the resync control unavailable unless the node is a clustered secondary.

Example fix

// before
clusterManager.TriggerResyncForConfig();

// after
if (!clusterManager.ClusterInitialized)
    return BadRequest("Not clustered; cannot resync.");
clusterManager.TriggerResyncForConfig();
Defensive patterns

Strategy: validation

Validate before calling

if (!clusterManager.ClusterInitialized)
    return BadRequest("Not clustered; cannot resync.");
clusterManager.TriggerResyncForConfig();

Type guard

static bool CanResyncConfig(ClusterManager cm) => cm.ClusterInitialized;

Try / catch

try { clusterManager.TriggerResyncForConfig(); }
catch (DnsServerException ex) when (ex.Message.Contains("not initialized"))
{ /* not clustered; no-op */ }

Prevention

When it happens

Trigger: Calling TriggerResyncForConfig (the 'force full resync' action) on a server that is not clustered.

Common situations: Operator clicked 'resync configuration' on a standalone primary; the node already left the cluster; cluster state file missing so _clusterNodes is empty.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/74bc5d46810b56eb. Report an issue: GitHub.