# rpc 错误：代码 = FailedPrecondition 描述 = 流被 RST_STREAM 终止，错误代码：PROTOCOL_ERROR

- **ID:** `go/grpc-failed-precondition-stream-closed`
- **领域:** go
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

由于协议违规，例如在流关闭后发送数据或格式错误的帧，gRPC 流被服务器或客户端重置。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.x | active | — | — |

## 解决方案

1. **** (85% 成功率)
   ```
   Call CloseSend() only after all messages are sent, and handle the send error properly.
   ```
2. **** (70% 成功率)
   ```
   Configure the proxy to support HTTP/2 and not buffer or modify stream frames.
   ```

## 无效尝试

- **** — This error is not timeout-related; increasing timeout will not prevent RST_STREAM. (90% 失败率)
- **** — gRPC requires HTTP/2; disabling it will break gRPC entirely. (100% 失败率)
