dial tcp: lookup example.com: no such host
Go couldn't resolve the hostname
Seen in Go (net), Docker, Kubernetes, Terraform, Helm
The DNS lookup returned no address for the name, so Go never tried to connect.
Common causes
- A typo in the hostname, or the record does not exist.
- An internal or cluster name that does not resolve from where the program runs.
- The resolver shown after "on" is not the one that knows the name.
How to fix it
- Check the exact name in the message, then look it up.
- In Kubernetes, use the full service name (service.namespace.svc.cluster.local) and check CoreDNS.
- Check /etc/resolv.conf, or set GODEBUG=netdns=go+1 to log which resolver Go uses.
Got a different message? Paste it into the error explainer.
Related errors
- socket.gaierror: [Errno -2] Name or service not known · Python couldn't resolve the hostname
- socket.gaierror: [Errno -3] Temporary failure in name resolution · Python couldn't reach a DNS resolver
- java.net.UnknownHostException · Java couldn't resolve the hostname
- No such host is known · Windows couldn't resolve the hostname
- php_network_getaddresses: getaddrinfo failed · PHP couldn't resolve the hostname
- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed · Python couldn't verify the server's certificate
- certificate verify failed: Hostname mismatch, certificate is not valid for · The certificate doesn't cover this hostname
- Max retries exceeded with url · requests gave up connecting to the URL
- requests.exceptions.ConnectTimeout · Python couldn't open the connection in time
- requests.exceptions.ReadTimeout · The server took too long to respond
- ConnectionRefusedError: [Errno 111] Connection refused · Nothing is listening on that port
- http.client.RemoteDisconnected: Remote end closed connection without response · The server closed the connection without replying