UNAVAILABLE
api
network_error
ai_generated
true
gRPC error: UNAVAILABLE: name resolution failed for target dns:///my-service:50051
ID: api/grpc-unavailable-service-name
85%Fix Rate
88%Confidence
1Evidence
2024-06-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| gRPC v1.50+ | active | — | — | — |
| gRPC-Go v1.50+ | active | — | — | — |
| gRPC-Java v1.50+ | active | — | — | — |
Root Cause
The DNS resolver cannot resolve the service hostname to an IP address, or the resolved address is unreachable.
generic中文
DNS 解析器无法将服务主机名解析为 IP 地址,或者解析后的地址不可达。
Official Documentation
https://grpc.io/docs/guides/errors/Workarounds
-
85% success Check DNS resolution with nslookup or dig: nslookup my-service. Ensure the hostname is correct and the DNS server is reachable. If using Kubernetes, verify the service name and namespace: kubectl get svc my-service -n your-namespace
Check DNS resolution with nslookup or dig: nslookup my-service. Ensure the hostname is correct and the DNS server is reachable. If using Kubernetes, verify the service name and namespace: kubectl get svc my-service -n your-namespace
-
70% success Use an IP address directly in the target URI to bypass DNS: target ipv4:///10.0.0.1:50051 or configure a custom resolver in gRPC options.
Use an IP address directly in the target URI to bypass DNS: target ipv4:///10.0.0.1:50051 or configure a custom resolver in gRPC options.
中文步骤
使用 nslookup 或 dig 检查 DNS 解析:nslookup my-service。确保主机名正确且 DNS 服务器可达。如果使用 Kubernetes,验证服务名称和命名空间:kubectl get svc my-service -n your-namespace
直接在目标 URI 中使用 IP 地址以绕过 DNS:target ipv4:///10.0.0.1:50051,或在 gRPC 选项中配置自定义解析器。
Dead Ends
Common approaches that don't work:
-
60% fail
Restarting the gRPC client without fixing DNS configuration does not resolve the underlying resolution failure.
-
30% fail
Increasing the timeout for gRPC calls will not help if the hostname cannot be resolved at all.