NXDOMAIN, SERVFAIL and Other DNS Errors
Decode DNS response codes and browser error messages, find which server is failing and choose the right fix for each case.
Key takeaways
- NXDOMAIN is a definite "this name does not exist", while SERVFAIL is a "I could not find out".
- An empty answer with the NOERROR code means the name exists but has no record of the type you asked for.
- Compare your usual resolver with a second resolver and the authoritative server to locate the fault.
- A SERVFAIL that disappears when DNSSEC checking is disabled points to broken signatures or keys.
Every DNS reply carries a short status called a response code. NXDOMAIN means the name you asked about doesn't exist. SERVFAIL means the resolver tried to get an answer and couldn't. REFUSED means the server declined to answer you at all.
Those three point to very different fixes. A typo or a missing record produces the first. A broken name server or a failed security check produces the second. A wrongly aimed query produces the third. Reading the code tells you where to look before you change anything.
Where the codes come from
When your device needs an address, it asks a recursive resolver. The resolver either answers from its cache or works down the DNS tree to the authoritative server for the name. What happens during a DNS lookup traces that path.
The reply has a header with a response code field, often shortened to RCODE. The original DNS specifications define a small set of values, and a few more were added later.
| Code | Number | Plain meaning |
|---|---|---|
| NOERROR | 0 | The query was processed successfully |
| FORMERR | 1 | The server could not understand the query |
| SERVFAIL | 2 | The server failed to complete the request |
| NXDOMAIN | 3 | The name does not exist |
| NOTIMP | 4 | The server does not support this kind of request |
| REFUSED | 5 | The server declines to answer, usually by policy |
Browsers rarely show these words directly. They translate them into messages such as "this site can't be reached" or an error string mentioning name resolution. The wording varies by browser and version, so run a command-line lookup to see the real code.
Seeing the actual code
On macOS or Linux, dig prints the code in the header line, labeled status.
dig www.example.com A Look for a line like status: NOERROR or status: NXDOMAIN, and for the count of records in the ANSWER section. On Windows, PowerShell gives a readable error.
Resolve-DnsName www.example.com -Type A
nslookup www.example.com nslookup reports Non-existent domain for NXDOMAIN and Server failed for SERVFAIL. Using nslookup and dig shows how to read the rest of the output.
NXDOMAIN: the name does not exist
An authoritative server returns NXDOMAIN when nothing at all is defined at that name. Resolvers pass the answer on and cache it, for a period set by the zone's SOA record. This is called negative caching.
Usual causes include:
- A typo in the name, including a doubled domain such as
mail.example.com.example.com. - A record that was never created, or was created in a copy of the zone that isn't live.
- A domain that has expired or been placed on hold by the registrar or registry.
- A private name that only resolves inside a company network, queried from outside it.
- A cached negative answer from before you added the record.
To fix it, query the authoritative server directly. If it also says NXDOMAIN, the record is missing there. If it returns the record, your resolver is holding an old negative answer, and time or a cache flush will clear it. If the entire domain returns NXDOMAIN, check its registration status. Domain expiration and grace periods explains what happens after a missed renewal.
NOERROR with no answer
A lookup can succeed and still return nothing useful. The code is NOERROR, but the answer section is empty. People often call this NODATA.
It means the name exists, just without a record of the type you requested. A host with only an IPv4 address answers an AAAA query this way. A domain with a website but no mail setup does the same for MX.
This is normal in many cases. It becomes a problem when you expected the record, so check that you created the right type at the right name. A name can also exist only because something below it exists. If a.b.example.com has a record, then b.example.com exists too, and querying it gives an empty answer instead of NXDOMAIN on correctly behaving servers.
SERVFAIL: the lookup broke
SERVFAIL is the least specific code and the one that takes the most digging. The resolver is saying that something went wrong while it tried to answer.
Frequent reasons:
- Unreachable authoritative servers. They're down, blocked by a firewall or listed with wrong addresses.
- Lame delegation. The parent zone points to a server that doesn't actually serve the domain.
- DNSSEC validation failure. Signatures have expired, or the DS record at the registry doesn't match the zone's keys.
- A broken zone. The authoritative server couldn't load the file, or a secondary's copy went stale and expired.
- Resolver trouble. The resolver itself is overloaded or can't reach the internet.
Start by asking a different resolver. If it works there, suspect your own resolver or the network path to it. If every resolver fails, the problem is almost certainly on the domain's side.
Testing for a DNSSEC problem
DNSSEC adds signatures that validating resolvers check. If the check fails, they return SERVFAIL instead of handing you data they can't trust. You can ask a resolver to skip validation for one diagnostic query with the +cd option, short for checking disabled.
dig @1.1.1.1 example.com A
dig @1.1.1.1 example.com A +cd If the first returns SERVFAIL and the second returns records, the domain's DNSSEC chain is broken. The owner has to repair it, typically by correcting or removing the DS record at the registrar. Disabling validation on your side hides the symptom and removes the protection. DNSSEC explained shows how the chain fits together.
Many resolvers also return Extended DNS Errors, standardized in RFC 8914. These add a short explanation alongside the code, such as an expired signature or an answer served from stale cache. Recent versions of dig display them.
REFUSED, FORMERR and NOTIMP
REFUSED usually means you asked the wrong server. An authoritative server refuses questions about zones it doesn't host. A private resolver refuses clients outside its own network. If your own domain's name server returns REFUSED for your domain, it isn't configured to serve that zone.
FORMERR means the server couldn't parse the query. You'll rarely see it, and when you do, an old or faulty device that mishandles newer DNS extensions is a likely culprit.
NOTIMP means the server doesn't implement the requested operation. It tends to appear with unusual request types, not everyday lookups.
Timeouts are different
Sometimes there's no code at all. dig reports that the connection timed out and no servers could be reached. The query or the reply got lost.
Check that your device has working network access, that the resolver address is correct, and that a firewall isn't blocking port 53 over UDP and TCP. Large answers can require TCP, so a firewall that allows only UDP causes failures for some names and not others. Browsers report this case as the server not responding, covered in DNS server not responding.
A troubleshooting order
Work from the broadest question to the narrowest.
To inspect the delegation itself, dig example.com +trace follows the chain from the root downward and shows where it stops. Some networks intercept DNS, in which case a trace can fail even when the domain is healthy, so try from another connection before drawing conclusions.
Three worked examples
Say a new subdomain, shop.example.com, shows an error an hour after you created it. A query to the authoritative server returns the record, but your usual resolver says NXDOMAIN. The record is fine. You looked it up before it existed, or someone else did, and the resolver is holding that negative answer. Wait for it to expire or flush the caches you control.
Next, say a whole domain returns SERVFAIL on one public resolver and also on another, shortly after a move to a new DNS host. Repeating the query with +cd returns correct records. A DS record left over from the old host is still at the registry, pointing to a key that no longer signs anything. Removing or replacing that DS record at the registrar fixes it, after caches expire.
Finally, say a lookup for an internal name such as files.corp.example.com works in the office and returns NXDOMAIN from home. Nothing is broken. The name exists only on the company's internal DNS, and you need the VPN, or whatever remote access your IT team provides, to use that resolver. This arrangement is called split-horizon DNS.
What to include when you report a problem
If the fault is on someone else's side, a precise report gets it fixed faster. Send the exact name and record type you queried, the resolver address you used, the response code, the time with your time zone and the network you were on. Paste the full command output instead of a screenshot of a browser message. Note whether other resolvers and the authoritative server gave different results.
Errors that are put there on purpose
A filtering resolver may answer NXDOMAIN, REFUSED or a placeholder address for names it blocks. If a site fails only on one network, or only with one resolver, a block list is a likely reason. Check the filter's logs, or ask whoever runs it. DNS filtering describes the common reply styles.
Some internet providers have also redirected nonexistent names to their own search or advertising page instead of returning NXDOMAIN. If a random made-up name resolves to an address on your connection, that's what's happening, and changing resolvers or enabling encrypted DNS usually stops it.