go
network_error
ai_generated
true
rpc error: code = Unavailable desc = connection error: dial tcp: lookup host on 127.0.0.11:53: no such host
ID: go/grpc-unavailable-connection-error
80%Fix Rate
88%Confidence
0Evidence
2024-03-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.22 | active | — | — | — |
| 1.23 | active | — | — | — |
Root Cause
DNS resolution fails for the target gRPC server hostname, often due to misconfigured DNS or incorrect hostname in the client connection string.
generic中文
目标gRPC服务器主机名的DNS解析失败,通常是由于DNS配置错误或客户端连接字符串中的主机名不正确。
Workarounds
-
90% success Use IP address instead of hostname in the gRPC target.
conn, err := grpc.Dial("192.168.1.100:50051", grpc.WithInsecure()) -
85% success Configure custom DNS resolver in Go net package.
net.DefaultResolver = &net.Resolver{PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { d := net.Dialer{}; return d.DialContext(ctx, "udp", "8.8.8.8:53") }}
Dead Ends
Common approaches that don't work:
-
Retrying the same connection with backoff but not fixing DNS.
95% fail
DNS resolution remains broken; retries never succeed.
-
Changing port number in the dial string.
98% fail
The issue is hostname resolution, not port; changing port doesn't help.