go
network_error
ai_generated
true
rpc错误:代码=不可用 描述=名称解析器错误:DNS查询失败:查找myservice.example.com:没有这样的主机
rpc error: code = Unavailable desc = name resolver error: failed to query DNS: lookup myservice.example.com: no such host
ID: go/grpc-unavailable-dns-resolution-failed
80%修复率
88%置信度
0证据数
2025-04-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.0 | active | — | — | — |
| 1.1 | active | — | — | — |
根因分析
gRPC目标中使用的DNS名称无法解析,通常是由于主机名错误或DNS配置错误。
English
The DNS name used in the gRPC target cannot be resolved, often due to incorrect hostname or DNS misconfiguration.
解决方案
-
95% 成功率 Verify the DNS record and correct the hostname.
Use nslookup or dig to check: nslookup myservice.example.com. Update the target address accordingly.
-
90% 成功率 Use an IP address directly instead of a hostname.
conn, err := grpc.Dial("10.0.0.1:8080", grpc.WithInsecure())
无效尝试
常见但无效的做法:
-
Use a random IP address hoping it resolves.
100% 失败
The client specifically tries to resolve the given name; random IPs are ignored.
-
Ignore the error and retry indefinitely.
100% 失败
Without DNS resolution, the connection will never succeed.