ENOTFOUND
node
network
ai_generated
true
Error: getaddrinfo ENOTFOUND hostname
ID: node/node-dns-resolution-failed
88%Fix Rate
90%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 20 | active | — | — | — |
Root Cause
DNS lookup failed for the target hostname. The system resolver cannot translate the domain name to an IP address.
genericWorkarounds
-
90% success Verify the hostname is correct and the DNS server is reachable
Run 'nslookup hostname' or 'dig hostname' to confirm DNS resolution works at the OS level
Sources: https://nodejs.org/api/dns.html
-
85% success Use dns.setServers() to specify custom DNS servers
const dns = require('dns'); dns.setServers(['8.8.8.8', '8.8.4.4']); before making requestsSources: https://nodejs.org/api/dns.html#dnssetserversservers
Dead Ends
Common approaches that don't work:
-
Retrying the request in a tight loop without backoff
75% fail
DNS failures are often transient but require time to recover; flooding the resolver makes it worse
-
Hardcoding IP addresses to bypass DNS
70% fail
IP addresses change over time, especially for cloud services; breaks when infrastructure rotates
Error Chain
Leads to:
Preceded by:
Frequently confused with: