{"record":{"id":"a42605a12b22843e","repo":"TechnitiumSoftware/DnsServer","slug":"cannot-set-records-please-try-again-a42605","errorCode":null,"errorMessage":"Cannot set records. Please try again.","messagePattern":"Cannot set records\\. Please try again\\.","errorType":"exception","errorClass":"DnsServerException","httpStatus":null,"severity":"warning","filePath":"DnsServerCore/Dns/Zones/PrimaryZone.cs","lineNumber":2608,"sourceCode":"                    TriggerNotify();\n                    break;\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 > 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                    CommitAndIncrementSerial(deletedRecords, records);\n\n                    if (_dnssecStatus != AuthZoneDnssecStatus.Unsigned)\n                        UpdateDnssecRecordsFor(this, type);\n\n                    TriggerNotify();\n                    break;\n            }\n        }\n\n        public override bool AddRecord(DnsResourceRecord record)\n        {\n            if (_dnssecStatus != AuthZoneDnssecStatus.Unsigned)\n            {\n                switch (record.Type)\n                {\n                    case DnsResourceRecordType.ANAME:","sourceCodeStart":2590,"sourceCodeEnd":2626,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/Zones/PrimaryZone.cs#L2590-L2626","documentation":"Thrown by PrimaryZone.SetRecords() in the default branch when TrySetRecords for the requested record type returns false. The TTL and type checks already passed, so this is a record-store-layer failure to commit the new RRset. The message asks to retry, signalling a transient rather than permanent condition.","triggerScenarios":"TrySetRecords(type, records, out deletedRecords) returns false while replacing a normal RRset. Typically concurrent modification, a transient store/IO error, or an inability to commit atomically.","commonSituations":"Concurrent record writers (other API calls, replication, notify) mutating the zone; backing store temporarily locked or low on resources; race between zone flush and record update.","solutions":["Retry SetRecords after a short backoff; the message indicates a transient failure.","Serialize record mutations for a given zone to avoid concurrent TrySetRecords contention.","If retries persistently fail, check the server log for the underlying store/IO error reported by TrySetRecords."],"exampleFix":"// before\nzone.SetRecords(type, records);\n\n// after\nfor (int attempt = 0; ; attempt++)\n{\n    try { zone.SetRecords(type, records); break; }\n    catch (DnsServerException) when (attempt < 2) { Thread.Sleep(Backoff(attempt)); }\n}","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"for (int attempt = 0; attempt < 3; attempt++)\n{\n    try { zone.SetRecords(type, records); return; }\n    catch (DnsServerException ex) when (ex.Message == \"Cannot set records. Please try again.\" && attempt < 2)\n    { Thread.Sleep(TimeSpan.FromSeconds(1 << attempt)); }\n}","preventionTips":["Serialize record mutations per zone to avoid TrySetRecords contention.","Use bounded exponential backoff for 'Please try again.' failures.","Inspect server logs if retries exhaust, since the underlying store error is logged separately."],"tags":["dns","record","transient","retry","concurrency"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}