TechnitiumSoftware/DnsServer · error · InvalidOperationException
Cannot set records in Catalog zone.
Error message
Cannot set records in Catalog zone.
What it means
CatalogZone.SetRecords only accepts SOA records (for zone transfer compatibility with BIND). The default case throws InvalidOperationException for all other record types. Catalog zones (RFC 9432) are special-purpose zones whose contents are managed automatically through member zone membership — they are not general-purpose zones where arbitrary records can be set. Only the fixed SOA is writable.
Source
Thrown at DnsServerCore/Dns/Zones/CatalogZone.cs:417
{
switch (type)
{
case DnsResourceRecordType.SOA:
if ((records.Count != 1) || !records[0].Name.Equals(_name, StringComparison.OrdinalIgnoreCase))
throw new InvalidOperationException("Invalid SOA record.");
DnsResourceRecord newSoaRecord = records[0];
DnsSOARecordData newSoa = newSoaRecord.RDATA as DnsSOARecordData;
//reset fixed record values
DnsSOARecordData modifiedSoa = new DnsSOARecordData("invalid", "invalid", newSoa.Serial, newSoa.Refresh, newSoa.Retry, newSoa.Expire, newSoa.Minimum);
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.");
}View on GitHub (pinned to d0484b6c1e)
Solutions
- Do not attempt to set non-SOA records on a CatalogZone — use a PrimaryZone or SecondaryZone for general records.
- Add a zone-type check in calling code: skip or reject record operations on CatalogZone unless type is SOA.
- For member zone management, use the dedicated CatalogZone member-management APIs (AddMemberZone, RemoveMemberZone) instead of SetRecords.
Example fix
// before
catalogZone.SetRecords(DnsResourceRecordType.A, aRecords);
// throws: Cannot set records in Catalog zone
// after
if (catalogZone.GetZoneTypeName() == "Catalog" && type != DnsResourceRecordType.SOA)
throw new InvalidOperationException("Catalog zones only support SOA records.");
// use a PrimaryZone for A records instead Defensive patterns
Strategy: type-guard
Validate before calling
if (zone is CatalogZone && type != DnsResourceRecordType.SOA)
throw new InvalidOperationException("Catalog zones only support SOA records via SetRecords.");
zone.SetRecords(type, records); Type guard
static bool CanSetRecords(Zone zone, DnsResourceRecordType type)
=> !(zone is CatalogZone) || type == DnsResourceRecordType.SOA; Prevention
- Check zone type before calling SetRecords — catalog zones only accept SOA.
- Use catalog-specific member-management APIs for catalog zone content.
- Build zone-type-aware dispatch in generic zone-management code.
When it happens
Trigger: Calling SetRecords on a CatalogZone with any record type other than SOA (A, AAAA, MX, TXT, NS, PTR, etc.). Reached through generic zone-management code or API handlers that don't check the zone type before calling SetRecords.
Common situations: Zone management UI/API that applies the same SetRecords path to all zone types; scripts that blindly push records to all zones; attempting to manually add custom records to a catalog zone; zone import tools that don't filter by zone type.
Related errors
- Cannot add record in Catalog zone.
- Cannot delete 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/4b008b4b58a7aeec.
Report an issue: GitHub.