Error: getaddrinfo ENOTFOUND host / Name or service not known
DNS lookup for the hostname failed — the name is wrong, doesn’t exist, or this machine can’t resolve it.
getaddrinfo ENOTFOUNDName or service not knownCould not resolve hostnodename nor servname providedTemporary failure in name resolution Meaning
Before connecting, the client resolves the hostname to an IP. ENOTFOUND (Node), socket.gaierror / “Name or service not known” (Python, Linux) and “Could not resolve host” (curl) all mean that step failed.
Common causes
- Typo in hostname, or protocol included in a host field (
https://api.x.comwhere onlyapi.x.comis expected) - Internal hostname not resolvable from this network/container
- Docker service name used outside the compose network
- DNS server down / no internet / VPN required
- Domain expired or DNS record removed
⚡ Quick fix
- Resolve it yourself:
nslookup hostordig host - Pass only the hostname where a host is expected (no scheme, no path)
- Check VPN / corporate DNS, and
/etc/resolv.confinside containers - In Docker Compose, call services by their service name from inside the network
Detailed fix by platform
Linux
- Check DNS from the same machine/container:bash
nslookup api.example.com dig +short api.example.com cat /etc/resolv.conf docker compose exec app getent hosts db
How to diagnose
- Hostname — Exactly what string is resolved?
- DNS — Does nslookup work here?
- Network — VPN, container network or offline?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in API
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026