# rpc错误：代码=未实现 描述=方法/myservice.MyService/StreamData是流式方法，但客户端使用了非流式调用

- **ID:** `go/grpc-unimplemented-streaming-not-supported`
- **领域:** go
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

客户端尝试使用非流式RPC存根调用服务器流式或双向流式方法。

## 版本兼容性

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

## 解决方案

1. **Use the correct streaming client stub for the method.** (95% 成功率)
   ```
   stream, err := client.StreamData(ctx, &pb.StreamRequest{})
if err != nil { return err }
for {
    resp, err := stream.Recv()
    if err == io.EOF { break }
    if err != nil { return err }
    // process resp
}
   ```
2. **Regenerate protobuf code to ensure proper client stubs are created.** (90% 成功率)
   ```
   protoc --go_out=. --go-grpc_out=. --go-grpc_opt=require_unimplemented_servers=false myservice.proto
   ```

## 无效尝试

- **Use the same stub but with different parameters.** — The stub type is fixed; unary stub cannot handle streaming methods. (100% 失败率)
- **Ignore the error and treat the response as a single message.** — The server expects a stream; the client must use the correct streaming API. (100% 失败率)
