/errors/dig/couldnt-get-address-for-not-found
dig: couldn't get address for 'ns1.example.com': not found
- tool
- dig / nslookup
- exit code
- 1
- versions
- BIND 9.16, BIND 9.18+, BIND 9.20
- os
- linux, macos, windows
dig: couldn't get address for 'ns1.example.com': not found means dig could not turn the server name you gave after @ into an IP address, so it never sent your query. The problem is the server name (or your system resolver), not the name you are looking up. Put the server's IP address after @, or fix the server name. dig stops immediately with a non-zero exit status.
Where the message comes from
dig resolves the @server argument with the operating system's resolver before it builds the query. If that lookup fails, getaddresses() in bin/dig/dighost.c calls fatal("couldn't get address for '%s': %s", ...), where the last part is the BIND result text, usually not found. Messages from fatal() are prefixed with the program name (dig:) and go to standard error.
dig @ns1.example.com example.com A # fails if ns1.example.com does not resolve
dig @192.0.2.53 example.com A # an address skips the lookup
dig +short ns1.example.com # check the server name itself
dig @192.0.2.53 -p 5353 example.com A # a non-standard port goes in -pReplace the names and addresses with your own; 192.0.2.53 is a documentation address.
Common mistakes after @
| Written | Use instead |
|---|---|
| @1.1.1.1:53 | @1.1.1.1 (port 53 is the default) or @1.1.1.1 -p 53 |
| @https://cloudflare-dns.com/dns-query | @1.1.1.1 +https (BIND 9.18+ for DNS over HTTPS) |
| @ns1.exmaple.com | The correctly spelled name, or its IP address |
| @ns1 (a short name) | The fully qualified name, since search domains may not apply |
With +trace
During +trace, dig follows the delegation from the root and must resolve the name of each name server it is referred to. If a zone's NS record points to a name without an address (no glue and no A/AAAA record), dig prints couldn't get address for 'NAME': not found for that name server, on standard output and without the dig: prefix, and continues with the other name servers. It stops with the fatal form only when none of them resolves. Check the delegation at the parent zone (dig NS example.com @a.gtld-servers.net) and the A/AAAA records of the listed name servers.
Exit status
In current BIND versions (9.18 and later) a fatal() error exits with status 1 when nothing else has set an exit code. The dig manual lists exit status 10 for internal errors; older releases returned 10 for this message, so scripts should treat any non-zero status as a failure.