# 错误：google.protobuf.Struct 中存在未知字段 "new_field"

- **ID:** `go/grpc-unknown-protobuf-field`
- **领域:** go
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

客户端或服务器发送的 protobuf 消息包含较新版本 .proto 文件中新增的字段，但接收方使用的是旧编译版本，无法识别该字段。

## 版本兼容性

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

## 解决方案

1. **Regenerate the protobuf code with the latest .proto file** (95% 成功率)
   ```
   protoc --go_out=. --go-grpc_out=. your.proto
   ```
2. **Enable protobuf unknown field preservation to avoid errors** (85% 成功率)
   ```
   import "google.golang.org/protobuf/proto"
// Use proto.UnmarshalOptions{DiscardUnknown: true} when unmarshaling
   ```

## 无效尝试

- **Ignore the error and hope the message is processed successfully** — The error is returned by the protobuf unmarshaller, so the message is discarded entirely, and the RPC fails. (90% 失败率)
- **Manually parse the JSON representation instead of using protobuf** — This bypasses the type safety and can lead to data corruption or security issues, and still won't resolve the unknown field error. (70% 失败率)
