# UNAVAILABLE: grpc: 负载均衡策略 "round_robin" 未找到

- **ID:** `grpc/load-balancing-policy-not-found`
- **领域:** grpc
- **类别:** config_error
- **错误码:** `ELBNOTFOUND`
- **验证级别:** ai_generated
- **修复率:** 95%

## 根因

指定的负载均衡策略未在 gRPC 客户端中注册，通常是因为缺少相应的解析器插件或策略名称拼写错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| gRPC v1.57.0 | active | — | — |
| gRPC v1.61.0 | active | — | — |
| gRPC v1.66.0 | active | — | — |

## 解决方案

1. ```
   Register the 'round_robin' policy by importing the load balancer plugin: `import grpc.experimental; grpc.experimental.register_load_balancer('round_robin', grpc.experimental.RoundRobinLoadBalancer)`
   ```
2. ```
   Use a built-in policy like 'pick_first' (default) by removing the custom LB policy from the client configuration: `channel = grpc.insecure_channel(target)`
   ```
3. ```
   If using a service config, ensure the policy name matches exactly (case-sensitive) and is supported by the gRPC version, e.g., `{"loadBalancingConfig": [{"round_robin": {}}]}`.
   ```

## 无效尝试

- **Changing the target URI to use a different scheme like 'dns://'.** — The error is about the load balancing policy, not the resolver scheme; changing the scheme does not register the policy. (85% 失败率)
- **Setting the environment variable GRPC_LB_POLICY to a random string.** — Environment variables do not register custom policies; they only configure built-in ones. (95% 失败率)
- **Reinstalling the gRPC package without updating the policy registration code.** — The policy must be explicitly imported or registered in code; reinstalling does not add missing plugins. (90% 失败率)
