# rpc错误：代码=不可用 描述=名称解析器错误：DNS查询失败：查找myservice.example.com：没有这样的主机

- **ID:** `go/grpc-unavailable-dns-resolution-failed`
- **领域:** go
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

gRPC目标中使用的DNS名称无法解析，通常是由于主机名错误或DNS配置错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.0 | active | — | — |
| 1.1 | active | — | — |

## 解决方案

1. **Verify the DNS record and correct the hostname.** (95% 成功率)
   ```
   Use nslookup or dig to check: nslookup myservice.example.com. Update the target address accordingly.
   ```
2. **Use an IP address directly instead of a hostname.** (90% 成功率)
   ```
   conn, err := grpc.Dial("10.0.0.1:8080", grpc.WithInsecure())
   ```

## 无效尝试

- **Use a random IP address hoping it resolves.** — The client specifically tries to resolve the given name; random IPs are ignored. (100% 失败率)
- **Ignore the error and retry indefinitely.** — Without DNS resolution, the connection will never succeed. (100% 失败率)
