# gRPC error: UNAVAILABLE: name resolution failed for target dns:///my-service:50051

- **ID:** `api/grpc-unavailable-service-name`
- **Domain:** api
- **Category:** network_error
- **Error Code:** `UNAVAILABLE`
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

The DNS resolver cannot resolve the service hostname to an IP address, or the resolved address is unreachable.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| gRPC v1.50+ | active | — | — |
| gRPC-Go v1.50+ | active | — | — |
| gRPC-Java v1.50+ | active | — | — |

## Workarounds

1. **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** (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
   ```
2. **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.** (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.
   ```

## Dead Ends

- **** — Restarting the gRPC client without fixing DNS configuration does not resolve the underlying resolution failure. (60% fail)
- **** — Increasing the timeout for gRPC calls will not help if the hostname cannot be resolved at all. (30% fail)
