You added a marketing platform next to your transactional API, and a day later a DMARC aggregate report shows permerror with a lookup count over 10 — on a record you have not edited. Your own logs look unchanged. The limit is not a count of the includes you wrote; it is a count of DNS-querying terms across a tree of records other people publish, evaluated per message by the receiver. Here is that tree walked with records measured on 2026-11-29, where the count crosses 10 without you touching anything, and why the three limits behind this error are not the same rule.
What the 10-lookup limit actually counts
RFC 7208 §4.6.4 states it in one sentence: "SPF implementations MUST limit the total number of those terms to 10 during SPF evaluation, to avoid unreasonable load on the DNS. If this limit is exceeded, the implementation MUST return 'permerror'." [1] The subject is terms — not records, not includes. The actor is the implementation doing the evaluation, which is the receiver, not you. Nothing on your side raises the ceiling: the receiving implementation applies it, and the only limit in the RFC that an implementation may make configurable is the void-lookup one, which is a MAY [1].
The terms that cause a query
The RFC enumerates them: "the include, a, mx, ptr, and exists mechanisms, and the redirect modifier" [1]. Everything else in the same section sits outside the count — all, ip4 and ip6, and the exp modifier, which the RFC excludes because it resolves later rather than during evaluation [1]. An exp modifier therefore costs you nothing against the ten.
ptr is on the list and you should not use it. The RFC's own heading for the mechanism tells you as much, and the text advises against publishing it at all [1]. It spends a term and buys a reverse-DNS dependency.
Why your own record is not the thing being counted
The counter is one budget for the whole evaluation, not a fresh allowance each time the evaluator descends into another record [1]. include is not a copy-paste: it hands the target record to a nested evaluation, and the RFC itself admits the name was a bad choice [1]. Your record is the root of that tree. The tree is what gets counted.
Why adding a second provider breaks a record that was fine
The include you added is a subtree, not a term
Measured on 2026-11-29, mailgun.org publishes v=spf1 include:_spf.mailgun.org include:_spf.eu.mailgun.org -all [2]. Two includes. Follow the first: _spf.mailgun.org publishes v=spf1 include:_spf1.mailgun.org include:_spf2.mailgun.org ~all [2] — two more. Follow those: _spf1.mailgun.org is five ip4 terms and ~all [2], _spf2.mailgun.org is seven ip4 terms and ~all [2], _spf.eu.mailgun.org is eleven ip4 terms and ~all [2]. Zero DNS-querying terms at the leaves.
Walk it: 2 at the root, 2 inside _spf.mailgun.org, then 0, 0, 0. Four terms. The reader who counts includes gets 2; the receiver counts 4. That gap is the mechanism.
The shorthand breaks the other way too. Measured on 2026-11-29, _spf.salesforce.com publishes v=spf1 exists:%{i}._spf.mta.salesforce.com -all [2] — one term, zero includes.
| Record, measured 2026-11-29 | includes written | DNS-querying terms |
|---|---|---|
| mailgun.org | 2 | 4 |
| _spf.google.com | 0 | 0 |
| _spf.salesforce.com | 0 | 1 |
A record with four includes — Google, Microsoft, Mailgun, Mailchimp — is 4 includes but 6 terms: 0 for _spf.google.com [2], 0 for spf.protection.outlook.com [2], 2 for _spf.mailgun.org [2], 0 for servers.mcsv.net [2]. At 6 terms for four providers, two more providers whose includes each expand to 2 terms reach 10, and a seventh crosses it. That is arithmetic on the measured structure, not a measurement of any named provider.
The count can change without you editing anything
The terms inside an include target are published by the provider, not by you. Your record says "evaluate their record"; what that record contains is theirs to change. The count can move while your zone file stays byte-identical — the difference between a record that is correct and a record that is correct today.
The common case is still the one you caused: you added a provider whose include is a subtree. The other case is a provider editing their own record.
The count is also per message, and evaluation stops at the first match. Microsoft's docs make the consequence plain: a record can carry more than ten lookups and still pass for most traffic, because the walk often stops before it gets that far [3]. A record over the limit is not broken for every message — only for the messages that walk far enough.
What the receiver does when you exceed it
PermError is not fail
A permerror means the evaluator could not make sense of the domain's published records at all; the RFC treats it as a condition that needs the DNS operator to step in [1]. A fail is a verdict: this client is not authorised.
For DMARC the difference has teeth. DMARC passes only when a mechanism returns a pass for an aligned identifier [4], and it consumes the SPF result for the MAIL FROM identity [4]. A permerror is not a pass, so it cannot satisfy alignment. What the receiver then does is discretionary: RFC 7489 §6.6.2 leaves the handling of a permanent DNS error to the receiving side [4]. Microsoft documents its own behaviour — a message over the limit comes back as a permerror rather than a pass, and the non-delivery report it generates names the problem rather than a count [3]. That is Microsoft's behaviour, not a rule for every receiver.
What you can and cannot see from your side
The evaluation happened on their infrastructure, so your sending logs will not show it. You learn about it from a DMARC aggregate report, from a recipient, or from a bounce that quotes the error. Transmitly's DNS audit snapshots SPF records on a six-hour loop and alerts when a record changes or regresses [5]; it does not compute your lookup count, score your SPF, or show a DMARC report view. What it tells you is that the record moved, which is the half you can watch from your side.
The other half is the same separation as authentication is not deliverability: acceptance, delivery to MX and inbox placement are separate states, and authentication results are a further signal on top. Your own per-attempt delivery records answer what a remote MX did with the message, not how it evaluated your record.
Counting your own lookups without guessing
The manual walk
Start at the root:
dig +short TXT example.com
For every include, a, mx, ptr, exists and redirect term, add one to a running total, then query the target and repeat:
dig +short TXT _spf.mailgun.org
Two rules keep the walk honest. Count terms, not records: a record with five ip4 terms and one include costs one term. And accumulate across the whole walk rather than counting per level, because the limit is a single global counter [1]. The walk ends at a record with no DNS-querying terms left in it — for the Mailgun tree, _spf1, _spf2 and _spf.eu [2][2][2].
What a checker will and will not tell you
Run one and you get the tree as it stands at that moment, totalled. It catches the arithmetic error above faster than a manual walk. Microsoft's docs note that some tools calculate the lookup count for you [3], and Google's own SPF troubleshooting page names its Check MX tool in the Google Admin Toolbox [6].
What a checker will not tell you: what the tree looks like next month, which term to remove, or whether a given receiver enforces the void-lookup limit. It reports the tree, not the decision.
The fixes, and what each one costs you
Remove what you no longer send from
Cheapest, and the one most often skipped. An include is live if any traffic still leaves through that provider. Check the provider's dashboard for recent activity before you delete the term, and check your DMARC aggregate reports for a source you have forgotten.
Replace an include with ip4/ip6
Works, because ip4 and ip6 do not count [1]. It also rots: the provider's ranges change and your record is wrong in a way nothing alerts on. Microsoft's guidance is explicit that the approach leaves you watching the vendor for IP changes [3].
Flattening
It replaces a live lookup with a dated snapshot of the provider's ranges. The bill is maintenance: document which includes you replaced and when, monitor vendor documentation, and review and update at least quarterly [3]. It also collides with record size: a character-string in a TXT record tops out at 255 octets, so a long flattened record has to be split across quoted strings [1]; TXT RDATA is a list of character-strings, which is why the split is legal [7]; and the RFC wants the published record small enough that a query for it fits inside 512 octets [1]. Microsoft excludes its own include from this treatment, on the grounds that its sending ranges are dynamic and move often [3]. One option with a bill attached, not a default.
Subdomain delegation
Give each sending source its own name and each name gets its own budget — Microsoft puts it as each subdomain carrying its own ten lookups [3]. The cost is that each subdomain needs its own SPF record — the record on contoso.com does not cover marketing.contoso.com [3] — and each one needs its own alignment story under DMARC.
The void-lookup limit is a different limit, and it is a SHOULD
A void lookup is a query that comes back with a positive answer carrying no records, or with a name error (RCODE 3) [1]. The RFC says implementations "SHOULD limit "void lookups" to two. An implementation MAY choose to make such a limit configurable. In this case, a default of two is RECOMMENDED." [1] The 10-term limit is a MUST [1]. Two is not a hard ceiling the way ten is: whether it applies depends on the implementation evaluating your record, and no primary source states which receivers enforce it or at what value.
The address-record limits are a third thing, and they are MUSTs with different consequences. Evaluating one MX record is capped at ten address records, and exceeding that makes the mx mechanism produce a permerror [1]. The same ceiling on PTR records ends differently: anything past the first ten is discarded rather than erroring [1] — no permerror, the extra records do not participate. Three limits, three normative strengths, two failure modes. Treating them as one number misdiagnoses whichever one you hit.
What to check before you add the next provider
- Count the tree, not the record. Walk every include target and total the terms [1].
- Know which terms are yours and which are the provider's. The ones inside their record are theirs to change.
- Decide now what happens when a provider changes their record. A six-hour snapshot with an alert is one answer [5]; a quarterly review is another [3].
- Keep one SPF record per name. A second record is a different permerror, not this one [1].
- Expect the failure to surface in someone else's logs, not yours [4].
Sources
- RFC 7208 §4.6.4 DNS Lookup Limits — the 10-term MUST — RFC Editor (IETF), 2014-04-01
- mailgun.org TXT — measured 2026-11-29: two includes at the root — DNS (measured via Google Public DNS DoH, dns.google), 2026-11-29
- Microsoft 365 SPF setup — evaluation stops at the first match, so the count is per message — Microsoft Learn (Microsoft Defender for Office 365 docs), 2026-07-03
- RFC 7489 §4.2 — the two conditions for a DMARC pass — RFC Editor (IETF), 2015-03-01
- Transmitly /docs/dns — drift detection on SPF and related records — Transmitly, 2026-11-20
- Troubleshoot SPF issues — Google's own statement of the 10-lookup limit — Google Workspace Help, 2026-11-10
- RFC 1035 §3.3.14 — TXT RDATA is one or more character-strings — RFC Editor (IETF), 1987-11-01
This article was researched, written and edited by AI under human supervision, and checked against Rankwrite's public editorial rubric.