{"record":{"id":"efe83a3e851163d2","repo":"TechnitiumSoftware/DnsServer","slug":"the-record-type-is-not-supported-by-primary-zones","errorCode":null,"errorMessage":"The record type is not supported by primary zones.","messagePattern":"The record type is not supported by primary zones\\.","errorType":"exception","errorClass":"DnsServerException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/Zones/PrimarySubDomainZone.cs","lineNumber":90,"sourceCode":"\n                        break;\n                }\n            }\n\n            switch (type)\n            {\n                case DnsResourceRecordType.SOA:\n                    throw new InvalidOperationException(\"Cannot set SOA record on sub domain.\");\n\n                case DnsResourceRecordType.DNSKEY:\n                case DnsResourceRecordType.RRSIG:\n                case DnsResourceRecordType.NSEC:\n                case DnsResourceRecordType.NSEC3PARAM:\n                case DnsResourceRecordType.NSEC3:\n                    throw new InvalidOperationException(\"Cannot set DNSSEC records.\");\n\n                case DnsResourceRecordType.FWD:\n                    throw new DnsServerException(\"The record type is not supported by primary zones.\");\n\n                default:\n                    if (records[0].OriginalTtlValue > _primaryZone.GetZoneSoaExpire())\n                        throw new DnsServerException(\"Cannot set records: TTL cannot be greater than SOA EXPIRE.\");\n\n                    if (!TrySetRecords(type, records, out IReadOnlyList<DnsResourceRecord> deletedRecords))\n                        throw new DnsServerException(\"Cannot set records. Please try again.\");\n\n                    _primaryZone.CommitAndIncrementSerial(deletedRecords, records);\n\n                    if (_primaryZone.DnssecStatus != AuthZoneDnssecStatus.Unsigned)\n                        _primaryZone.UpdateDnssecRecordsFor(this, type);\n\n                    _primaryZone.TriggerNotify();\n                    break;\n            }\n        }\n","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/Zones/PrimarySubDomainZone.cs#L72-L108","documentation":"Thrown by PrimarySubDomainZone.SetRecords() when type is FWD. The FWD (forwarder) record type is the defining record of a Conditional Forwarder zone (ForwarderZone), not a record type that belongs in a primary zone; a primary zone is authoritative and answers from its own data, so embedding a forwarder directive is semantically invalid. DnsServerException, catchable. The same restriction applies to ForwarderZone.AddRecord at line 137.","triggerScenarios":"subZone.SetRecords(DnsResourceRecordType.FWD, records) on a PrimarySubDomainZone — e.g. importing a config that mixed forwarder records into a primary zone, or attempting to convert a delegation into a forwarder by adding a FWD record.","commonSituations":"Cross-zone import that does not respect zone type; UI that offers FWD as a record type on primary zones; migration scripts merging forwarder and primary zone data.","solutions":["Do not add FWD records to a primary zone or its sub-domains; if forwarding is needed, create a Conditional Forwarder zone for that name instead.","Filter FWD out of imported record sets for primary/sub-domain zones.","If the goal is conditional forwarding, replace the primary zone delegation with a ForwarderZone."],"exampleFix":"// before\nsubZone.SetRecords(DnsResourceRecordType.FWD, new[] { fwdRecord });\n\n// after\n// create a conditional forwarder zone instead\n_dnsServer.AddForwarderZone(name, protocol, forwarder, ...);","handlingStrategy":"validation","validationCode":"if (type == DnsResourceRecordType.FWD)\n    throw new InvalidOperationException(\"FWD records belong to Conditional Forwarder zones, not primary zones.\");\nzone.SetRecords(type, records);","typeGuard":"static bool IsAllowedPrimaryRecordType(DnsResourceRecordType t) => t != DnsResourceRecordType.FWD;","tryCatchPattern":"try { zone.SetRecords(type, records); }\ncatch (DnsServerException) when (type == DnsResourceRecordType.FWD) { /* create a ForwarderZone instead */ }","preventionTips":["FWD records are only valid on a Conditional Forwarder zone; never on a primary/sub-domain.","If forwarding is needed for a name, replace the delegation with a ForwarderZone.","Filter FWD from primary-zone imports."],"tags":["dns","primary-zone","subdomain","fwd-record","dnsserverexception"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}