Skip to content
MtrXTools

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

  1. Check the exact name in the message, then look it up.
  2. In Kubernetes, use the full service name (service.namespace.svc.cluster.local) and check CoreDNS.
  3. Check /etc/resolv.conf, or set GODEBUG=netdns=go+1 to log which resolver Go uses.
Look up the name

Got a different message? Paste it into the error explainer.

Related errors

All 32 Languages & runtimes errors