ERR_NAME_NOT_RESOLVED means the browser couldn't find the IP address for the domain you requested, so the connection failed before it ever started.
What "ERR_NAME_NOT_RESOLVED" Means
This is a DNS (Domain Name System) failure. Your browser asked a DNS resolver to translate a hostname like example.com into an IP address, and the resolver came back empty. No server was contacted, no TCP handshake happened — the request died at the DNS lookup stage.
Why It Happens
The three most common real causes are:
- Typo in the domain — you typed
gogle.cominstead ofgoogle.com. The DNS resolver has no record for it, so it returns NXDOMAIN. - DNS server is down or misconfigured — your router or OS is pointing to a resolver that isn't responding, or your
/etc/hostsfile has a stale entry that shadows the real record. - The domain genuinely doesn't exist — someone gave you a URL that was never registered, or its DNS records were deleted.
Example Code That Triggers It
In Node.js, this error surfaces when you make an HTTP request to a non-resolvable domain:
import { get } from "node:http";
// This domain does not exist — DNS lookup will fail
get("http://this-domain-does-not-exist-12345.com", (res) => {
console.log(`Status: ${res.statusCode}`);
}).on("error", (err) => {
// err.code === "ENOTFOUND" — Node's equivalent of ERR_NAME_NOT_RESOLVED
console.error(`DNS resolution failed: ${err.code}`);
console.error(err.message); // "getaddrinfo ENOTFOUND this-domain-does-not-exist-12345.com"
});
Run this and you'll see ENOTFOUND in the error object — that's Node's internal name for the same DNS failure Chrome reports as ERR_NAME_NOT_RESOLVED in the browser.
How to Fix It
The fix depends on which cause you're hitting. For a typo, correct the URL:
// Before (typo)
get("http://gogle.com", ...);
// After (correct)
get("http://google.com", ...);
For a broken DNS server, the fix is outside your code: flush your DNS cache (ipconfig /flushdns on Windows, sudo dscacheutil -flushcache on macOS) and check your resolver settings in /etc/resolv.conf (Linux) or your router's admin panel. Point to a known-good resolver like 8.8.8.8 or 1.1.1.1 temporarily to confirm.
Common Mistakes That Cause This
- Hardcoding environment-specific domains — I've seen devs hardcode
localhost:3000in API calls, then push to production where the resolver doesn't know that name. Useprocess.env.API_URLinstead. - Ignoring trailing periods or protocol mismatches —
http://example.com.(trailing dot) is technically valid but often trips up naive parsers, andhttps://on a domain with no TLS record will fail differently but still surface as a connection error.
When Should You Worry About This?
Worry when the error appears on a domain that worked minutes ago, or across multiple devices on the same network. That points to a DNS outage — either your provider's resolver is down or the domain's authoritative nameservers are failing. If it's only on your machine, it's a local cache or config issue. If it's everywhere, check the domain's DNS health with a tool like dig or nslookup before touching your code.
First thing to check: run nslookup <domain> in your terminal — if that fails, it's DNS, not your code.