# rpc error: code = Unavailable desc = failed to resolve service name: no such host

- **ID:** `go/grpc-unavailable-dns-resolution`
- **Domain:** go
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

DNS resolution fails because the target hostname does not exist or DNS server is unreachable.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.56.x | active | — | — |
| 1.57.x | active | — | — |

## Workarounds

1. **** (85% success)
   ```
   resolver := &customResolver{}; conn, err := grpc.Dial("dns:///service.example.com:50051", grpc.WithResolvers(resolver))
   ```
2. **** (90% success)
   ```
   nslookup service.example.com; verify /etc/resolv.conf
   ```
3. **** (80% success)
   ```
   conn, err := grpc.Dial("127.0.0.1:50051", grpc.WithInsecure())
   ```

## Dead Ends

- **Hardcoding an IP address instead of hostname.** — IP may change, causing future failures. (60% fail)
- **Retrying indefinitely without fixing DNS.** — DNS issue persists. (90% fail)
- **Modifying system DNS settings.** — May not be applicable in containerized environments. (50% fail)
