DNS · 2026-11-25 · 9 min

DNS NXDOMAIN, SERVFAIL and Browser Errors

NXDOMAIN, NODATA, SERVFAIL, REFUSED and FORMERR look identical in a browser. Use dig, nslookup and resolvectl to see which server returned which code.

By Open Error Codes EditorialReviewed 2026-11-25

A browser that cannot find a name shows one page and one token, but the DNS response behind it carries a specific code: NXDOMAIN, NODATA, SERVFAIL, REFUSED, FORMERR, or no answer at all. Each code points at a different server and a different fix, and the browser deliberately hides which one you got.

Five answers, five meanings

Every DNS response carries a four-bit RCODE in its header. RFC 1035 defines the base set: 0 NOERROR, 1 FORMERR, 2 SERVFAIL, 3 NXDOMAIN and 5 REFUSED. NODATA is not a separate RCODE. RFC 2308 defines it as a NOERROR response with an empty answer section, which is why a tool can report no error and still have no address for you. A timeout is not a code at all: it means no response arrived, so no server has expressed an opinion.

  • NXDOMAIN: the queried name does not exist. This is authoritative evidence, and it can be cached.
  • NODATA: the name exists but has no record of the type you asked for. Usually a wrong record type, or a CNAME whose target lacks that type.
  • SERVFAIL: the server could not complete resolution. Upstream timeout, unreachable authority, or failed DNSSEC validation.
  • REFUSED: policy. The server will not answer this client or this query; recursion may be off, or the client is outside the access list.
  • FORMERR: the query could not be parsed. A client, library or middlebox defect rather than a zone problem.
  • Timeout: nothing came back. UDP port 53 filtered, resolver down, or packet loss on the path.
  • BADVERS: an EDNS version mismatch, reported through the extended RCODE rather than the header field.

What the browser actually shows

Chrome and Edge reduce most name failures to ERR_NAME_NOT_RESOLVED, with ERR_NAME_RESOLUTION_FAILED for resolver failures that are not a plain missing name. Firefox shows a Server Not Found page carrying NS_ERROR_UNKNOWN_HOST, and a separate timeout page when no response arrives. None of these strings contains the RCODE, and none of them names the resolver that answered. The page is a symptom; the response code is the evidence.

The browser is also a poor instrument for a second reason: a resolver may answer from cache, so two attempts seconds apart can produce different results. Reproduce with a command-line query against the same resolver the operating system uses, then repeat it against a public resolver. If the two disagree, that difference is the finding.

Authoritative and recursive servers do different jobs

A stub resolver on the client asks a recursive resolver, which follows the delegation from the root through the top-level domain to the zone's authoritative nameservers. Only the authoritative server is entitled to say that a name does not exist, and its NXDOMAIN must be accompanied by the zone's SOA record in the authority section so the resolver knows how long to cache the negative answer. A recursive resolver that gets no answer, meets a broken delegation or fails validation cannot say the name does not exist; it returns SERVFAIL instead. That distinction is the most useful fact in DNS troubleshooting: NXDOMAIN describes the name, SERVFAIL describes the path to the answer.

DNSSEC turns bad data into SERVFAIL

A validating resolver checks RRSIG signatures against the DS record published in the parent zone. When a signature expires, a key rollover stops halfway, or the DS record and the zone's DNSKEY disagree, the resolver classifies the answer as bogus and returns SERVFAIL. The same zone answers normally through a resolver that does not validate, which produces the confusing pattern of SERVFAIL on one network and success on another. The AD flag marks an answer the resolver validated. To test the theory, query once normally and once with the checking-disabled bit set: if the second returns data while the first returns SERVFAIL, validation is the cause and the zone needs fixing, not the client.

Negative caching explains the record that will not appear

NXDOMAIN and NODATA are cached, not just positive answers. RFC 2308 sets the negative time to live to the smaller of the SOA record's own TTL and its MINIMUM field, and resolvers honour it. A record created a minute ago can therefore stay invisible for the full negative TTL, and a query that hits a cached NXDOMAIN never reaches the authoritative server at all. Flush the local cache, then query the authority directly to see whether the record is published. Do not call it slow propagation until you have seen the answer at the authoritative server.

The codes side by side

CodeMeaningTypical sourceBrowser surfaceNext check
NXDOMAINThe name does not existAuthoritative server, possibly cachedERR_NAME_NOT_RESOLVEDSpelling, zone contents, authority
NODATAName exists, no record of this typeAuthoritative serverERR_NAME_NOT_RESOLVEDRecord type, CNAME target
SERVFAILResolution could not completeRecursive or validating resolverERR_NAME_RESOLUTION_FAILEDDNSSEC, authority reachability
REFUSEDPolicy forbids the answerResolver access list or recursion settingERR_NAME_NOT_RESOLVEDClient network, recursion enabled
FORMERRThe query could not be parsedServer, client library or middleboxERR_NAME_NOT_RESOLVEDStandard client, EDNS options
TimeoutNo response arrivedNetwork path, firewall, resolverERR_CONNECTION_TIMED_OUTUDP 53, then TCP fallback
BADVERSUnsupported EDNS versionServer or middleboxUsually invisibleEDNS version, packet rewriting

A decision path

  1. Get the real code. Query the same resolver the operating system uses and read the status line; the browser token is not the code.
  2. Is it NXDOMAIN? Check the spelling and the registered domain, then query the authoritative server for the exact name and type.
  3. Is it NOERROR with no answers? Treat it as NODATA: confirm the record type, and follow any CNAME to its target.
  4. Is it SERVFAIL? Test DNSSEC with the checking-disabled bit, then query the authoritative servers directly to see whether they answer.
  5. Is it REFUSED? Confirm the resolver is allowed to answer this client and that recursion is enabled where the query needs it.
  6. Is it FORMERR? Retry with a standard client and without unusual EDNS options, then inspect any middlebox that rewrites DNS.
  7. Is it a timeout? Test TCP port 53, check filtering, and measure loss to the resolver before changing the resolver itself.
  8. Did the record change recently? Assume negative caching until the authority proves the record is live and the resolution is fresh.

Commands that separate the layers

dig is the reference client because it prints the status, the flags and the sections that nslookup compresses away. Query the system resolver first, then a known public resolver, then the authority. Keep +noall +answer for quick reading and drop it when you need the flags.

# The system resolver's answer, with status and flags
dig www.example.com A

# Compare against a public resolver
dig www.example.com A @1.1.1.1

# Walk the delegation from the root to the authoritative server
dig +trace www.example.com

# The zone's nameservers and their addresses
dig www.example.com NS +short
dig www.example.com NS

# Ask an authoritative server directly, without recursion
dig www.example.com A @ns1.example.com +norecurse
dig www.example.com SOA @ns1.example.com +norecurse

# DNSSEC evidence and a validation bypass for comparison
dig www.example.com A +dnssec
dig www.example.com A +cd

# Force TCP when a UDP answer looks truncated
dig www.example.com A +tcp

nslookup is present on hosts where dig is not installed. It prints the same server and status lines, and its debug mode shows the response sections. Run it against a named server to remove the system resolver from the question.

nslookup www.example.com
nslookup -type=MX www.example.com 1.1.1.1
nslookup -debug www.example.com 1.1.1.1

On Linux with systemd-resolved, resolvectl shows which link and which upstream server answered, which is the detail a browser never exposes. resolvectl query also reports the DNSSEC result for that lookup. On macOS, dscacheutil reads the directory service cache and works when a browser failure has no command-line equivalent.

# Which resolvers are configured, per link
resolvectl status

# A lookup with the resolver that answered it
resolvectl query www.example.com

# Cache health, then drop the cache
resolvectl statistics
resolvectl flush-caches

# macOS: query the cache and reset it
dscacheutil -q host -a name www.example.com
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

Testing the authoritative servers

Start from the delegation. Ask the parent zone for the nameserver set, then query every server in that set for the same name with +norecurse. An authoritative reply sets the aa flag; a reply without it came from a cache or from a server that is not authoritative for the zone. Compare the answers across servers, and compare the SOA serial on each one: a stale secondary ships old data and produces NXDOMAIN for names that exist on the primary. The SOA also carries the negative TTL, so it explains how long a wrong answer will persist.

If an authoritative server does not answer at all, check whether it is reachable on port 53 over both UDP and TCP, and whether it responds to a query for its own SOA. A server that answers one zone but not another is usually a configuration or zone-transfer problem rather than a network problem.

Evidence worth escalating with

Include the queried name and record type, the resolver address and the exact status, the flags from the response header, and the timestamp with its timezone. Add dig output from the system resolver and from one public resolver, plus the direct authoritative answer. State whether one name fails or the whole zone fails, and whether other applications on the same host fail too. That set separates a domain problem, a resolver problem and a client problem without another round trip.

Related DNS pages

The individual response codes have their own pages: NXDOMAIN, NODATA, SERVFAIL, REFUSED, FORMERR, timeout and BADVERS. Browser-side hubs are Chrome, Edge and Firefox, and the protocol overview is at DNS.

Sources

Search the code you are seeing

Every page links the official source and the date it was last checked.

Search codes