TechnitiumSoftware/DnsServer · error · InvalidOperationException
Cannot delete record in Catalog zone.
Error message
Cannot delete record in Catalog zone.
What it means
CatalogZone.DeleteRecords(type) unconditionally throws InvalidOperationException. Catalog zones maintain their content through automatic member zone management — the records within are derived from member zone membership. Bulk deleting records by type would corrupt the catalog's structure. Member zone removal must go through the dedicated RemoveMemberZone path.
Source
Thrown at DnsServerCore/Dns/Zones/CatalogZone.cs:429
DnsResourceRecord modifiedSoaRecord = new DnsResourceRecord(_name, DnsResourceRecordType.SOA, DnsClass.IN, 0, modifiedSoa) { Tag = newSoaRecord.Tag };
base.SetRecords(type, [modifiedSoaRecord]);
break;
default:
throw new InvalidOperationException("Cannot set records in Catalog zone.");
}
}
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 queriableView on GitHub (pinned to d0484b6c1e)
Solutions
- Do not call DeleteRecords on CatalogZone — use RemoveMemberZone to manage catalog contents.
- Add a zone-type check: skip DeleteRecords for CatalogZone instances.
- To reset a catalog zone, delete and recreate it rather than deleting records.
Example fix
// before
catalogZone.DeleteRecords(DnsResourceRecordType.PTR);
// throws: Cannot delete record in Catalog zone
// after
if (zone is CatalogZone catZone)
catZone.RemoveMemberZone(memberName); // use catalog-specific API
else
zone.DeleteRecords(type); Defensive patterns
Strategy: type-guard
Validate before calling
if (zone is CatalogZone)
throw new InvalidOperationException("DeleteRecords is not supported on Catalog zones. Use RemoveMemberZone instead.");
zone.DeleteRecords(type); Type guard
static bool CanDeleteRecords(Zone zone) => zone is not CatalogZone;
Prevention
- Guard all DeleteRecords call sites with a CatalogZone type check.
- Use RemoveMemberZone for catalog zone content management.
- In cleanup scripts, skip catalog zones or handle them separately.
When it happens
Trigger: Calling DeleteRecords(DnsResourceRecordType) on a CatalogZone with any record type. Reached through generic zone-cleanup or record-management code that doesn't check zone type.
Common situations: Zone management UI/API that provides a 'delete all records of type X' button applied uniformly; cleanup scripts; zone reset operations that call DeleteRecords on all zones.
Related errors
- Cannot set records in Catalog zone.
- Cannot add record in Catalog zone.
- Cannot delete records in Catalog zone.
- Cannot update record in Catalog zone.
- Failed to find '{memberZoneName}' member zone entry in '{zon
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/5052b3269bc4415b.
Report an issue: GitHub.