TechnitiumSoftware/DnsServer · error · InvalidOperationException

Cannot update record in Catalog zone.

Error message

Cannot update record in Catalog zone.

What it means

CatalogZone.UpdateRecord unconditionally throws InvalidOperationException. Record updates are not permitted in catalog zones because the zone content is structurally derived from member zone membership. Updating a record in place would violate the catalog zone's managed structure (RFC 9432). The only writable record is SOA, which is handled through SetRecords.

Source

Thrown at DnsServerCore/Dns/Zones/CatalogZone.cs:439

        public override bool AddRecord(DnsResourceRecord record)
        {
            throw new InvalidOperationException("Cannot add record in Catalog zone.");
        }

        public override bool DeleteRecords(DnsResourceRecordType type)
        {
            throw new InvalidOperationException("Cannot delete record in Catalog zone.");
        }

        public override bool DeleteRecord(DnsResourceRecordType type, DnsResourceRecordData record)
        {
            throw new InvalidOperationException("Cannot delete records in Catalog zone.");
        }

        public override void UpdateRecord(DnsResourceRecord oldRecord, DnsResourceRecord newRecord)
        {
            throw new InvalidOperationException("Cannot update record in Catalog zone.");
        }

        public override IReadOnlyList<DnsResourceRecord> QueryRecords(DnsResourceRecordType type, bool dnssecOk)
        {
            if (type == DnsResourceRecordType.SOA)
                return base.QueryRecords(type, dnssecOk); //allow SOA for zone transfer to work with bind

            return []; //catalog zone is not queriable
        }

        #endregion

        #region properties

        public override string CatalogZoneName
        {
            get { return base.CatalogZoneName; }
            set { throw new InvalidOperationException(); }

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Do not call UpdateRecord on CatalogZone — for SOA changes use SetRecords(SOA, ...); for member changes use the catalog member-management APIs.
  2. Add a zone-type check to route catalog zones away from UpdateRecord.
  3. If the intent is to modify SOA timers, use SetRecords with the new SOA data.

Example fix

// before
catalogZone.UpdateRecord(oldRecord, newRecord);
// throws: Cannot update record in Catalog zone

// after
if (zone is CatalogZone catZone)
{
    if (newRecord.Type == DnsResourceRecordType.SOA)
        catZone.SetRecords(DnsResourceRecordType.SOA, new[] { newRecord });
    // else: not supported, skip or error
}
else
    zone.UpdateRecord(oldRecord, newRecord);
Defensive patterns

Strategy: type-guard

Validate before calling

if (zone is CatalogZone)
{
    if (newRecord.Type == DnsResourceRecordType.SOA)
        zone.SetRecords(DnsResourceRecordType.SOA, new[] { newRecord });
    else
        throw new InvalidOperationException("UpdateRecord is not supported on Catalog zones.");
}
else
    zone.UpdateRecord(oldRecord, newRecord);

Type guard

static bool CanUpdateRecord(Zone zone) => zone is not CatalogZone;

Prevention

When it happens

Trigger: Calling UpdateRecord(oldRecord, newRecord) on a CatalogZone instance. Reached through generic zone-management code that handles record edits uniformly.

Common situations: Zone management UI/API that provides record editing for all zone types; scripts that update records across multiple zones; zone-sync operations that attempt to update records in catalog zones.

Related errors


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