TechnitiumSoftware/DnsServer · error · DnsServerException

Cannot update record: zone '{zoneName}' does not exists.

Error message

Cannot update record: zone '{zoneName}' does not exists.

What it means

Thrown by UpdateRecord when _root.TryGet(zoneName, oldRecord.Name, out AuthZone) fails, meaning the sub-domain node for oldRecord.Name does not exist in the zone tree under zoneName. The record being updated must already exist at that exact name. Note: the message contains a grammar typo ('does not exists') in the source.

Source

Thrown at DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs:2311

                return true;
            }

            return false;
        }

        public void UpdateRecord(string zoneName, DnsResourceRecord oldRecord, DnsResourceRecord newRecord)
        {
            ValidateIfDomainBelongsToZone(zoneName, oldRecord.Name);
            ValidateIfDomainBelongsToZone(zoneName, newRecord.Name);

            if (oldRecord.Type != newRecord.Type)
                throw new DnsServerException("Cannot update record: new record must be of same type.");

            if (oldRecord.Type == DnsResourceRecordType.SOA)
                throw new DnsServerException("Cannot update record: use SetRecords() for updating SOA record.");

            if (!_root.TryGet(zoneName, oldRecord.Name, out AuthZone authZone))
                throw new DnsServerException("Cannot update record: zone '" + zoneName + "' does not exists.");

            switch (oldRecord.Type)
            {
                case DnsResourceRecordType.CNAME:
                case DnsResourceRecordType.DNAME:
                case DnsResourceRecordType.APP:
                    if (oldRecord.Name.Equals(newRecord.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        authZone.SetRecords(newRecord.Type, new DnsResourceRecord[] { newRecord });

                        if (authZone is SubDomainZone subDomainZone)
                            subDomainZone.AutoUpdateState();
                    }
                    else
                    {
                        authZone.DeleteRecords(oldRecord.Type);

                        if (authZone is SubDomainZone subDomainZone)

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Before calling UpdateRecord, verify the record exists by calling NameExists or querying records for oldRecord.Name.
  2. Refresh the record list in the client UI before attempting edits to avoid stale state.
  3. If the record was deleted concurrently, re-fetch and either re-add it or inform the user.
  4. Ensure oldRecord.Name is the fully qualified domain name matching what is stored in the zone.

Example fix

// before
authZoneManager.UpdateRecord("example.com", oldRecord, newRecord);

// after
if (!authZoneManager.NameExists("example.com", oldRecord.Name))
    throw new InvalidOperationException($"Record '{oldRecord.Name}' not found in zone; it may have been deleted.");
authZoneManager.UpdateRecord("example.com", oldRecord, newRecord);
Defensive patterns

Strategy: validation

Validate before calling

if (!authZoneManager.NameExists(zoneName, oldRecord.Name))
    throw new InvalidOperationException($"Record '{oldRecord.Name}' not found in zone '{zoneName}'.");

Type guard

static bool RecordNameExists(AuthZoneManager mgr, string zoneName, string domain)
    => mgr.NameExists(zoneName, domain);

Try / catch

try
{
    authZoneManager.UpdateRecord(zoneName, oldRecord, newRecord);
}
catch (DnsServerException ex) when (ex.Message.Contains("does not exists"))
{
    logger.LogWarning("Update failed: '{Name}' not found in '{Zone}'; refreshing.", oldRecord.Name, zoneName);
    // re-fetch and retry or inform user
}

Prevention

When it happens

Trigger: Calling UpdateRecord where oldRecord.Name does not correspond to any existing node in the zone tree. This happens when the old record was already deleted, was never added, or the name does not match any sub-domain zone node. The zone (zoneName) itself exists, but the specific record name within it does not.

Common situations: Stale client state where the UI shows a record that was already removed; concurrent deletion by another admin/session; oldRecord.Name has a typo or formatting difference (e.g. relative vs fully qualified); record exists in a different zone than specified.

Related errors


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