go
network_error
ai_generated
true
rpc 错误:代码 = Unavailable,描述 = 最后的解析器错误:产生了零个地址
rpc error: code = Unavailable desc = last resolver error: produced zero addresses
ID: go/grpc-code-unavailable-lb-policy
80%修复率
85%置信度
0证据数
2024-11-07首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.50+ | active | — | — | — |
根因分析
名称解析器返回了零个地址。常见于基于 DNS 的目标(dns:///)主机名无法解析,或自定义解析器返回空更新。
English
The name resolver returned no addresses. Common with DNS-based targets (dns:///) when the hostname doesn't resolve, or with custom resolvers returning empty updates.
解决方案
-
85% 成功率
Verify the target scheme and hostname resolve. Use passthrough for a literal address: conn, _ := grpc.NewClient("passthrough:///10.0.0.5:50051", grpc.WithTransportCredentials(insecure.NewCredentials())) Or fix DNS: `nslookup myservice.default.svc.cluster.local` -
80% 成功率
Register a custom resolver that logs address updates: resolver.Register(&myResolver{})
无效尝试
常见但无效的做法:
-
70% 失败
Bypasses load balancing and breaks TLS SNI/hostname verification.
-
90% 失败
No addresses will ever appear if DNS is broken; waiting longer doesn't help.