Issue Description
I tested/reproduced this with Cloudflare, but it may affect other providers too since automatic DNS management uses the same set_rrset flow.
When automatic DNS management syncs SPF, it appears to target the entire apex TXT RRSet instead of only SPF TXT records.
For example, existing DNS may contain:
domain.com TXT "google-site-verification=..."
domain.com TXT "v=spf1 mx -all"
SPF sync is scoped to:
domain.com TXT
rather than only TXT values beginning with:
v=spf1
As a result, unrelated apex TXT records can be treated as stale and deleted. In my case, a non-SPF TXT record was deleted, then the task tried to add the SPF record and failed because the SPF record already existed:
Failed to create DNS record for domain.com.: Failed to create DNS record: API error: BadRequest {"result":null,"success":false,"errors":[{"code":81058,"message":"An identical record already exists."}],"messages":[]}
Expected Behavior
Only update SPF record.
Actual Behavior
Deletes unrelated TXT records when syncing DNS.
Reproduction Steps
- Configure a domain that has existing TXT records at Zone apex in Stalwart.
- Enable automatic DNS for that domain and make sure SPF Records are selected for Record types.
- Check zone and unrelated TXT record will be deleted.
Relevant Log Output
Failed to create DNS record for domain.com.: Failed to create DNS record: API error: BadRequest {"result":null,"success":false,"errors":[{"code":81058,"message":"An identical record already exists."}],"messages":[]}
Stalwart Version
v0.16.x
Installation Method
Docker
Database Backend
RocksDB
Blob Storage
RocksDB
Search Engine
Internal
Directory Backend
Internal
Additional Context
The current method of DNS syncing works for other record types since those names are specific and not typically configured at the apex.
I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.
on
I have searched this support forum (open and closed topics) and confirm this is not a duplicate.
on
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on