# rpc 错误：代码 = Internal 描述 = grpc：序列化时出错：字符串字段包含无效的 UTF-8

- **ID:** `go/grpc-internal-status-details`
- **领域:** go
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

protobuf 字符串字段包含不是有效 UTF-8 的字节。protobuf 字符串必须是有效的 UTF-8；否则序列化会失败。

## 版本兼容性

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

## 解决方案

1. **** (90% 成功率)
   ```
   s = strings.ToValidUTF8(s, "")
   ```
2. **** (85% 成功率)
   ```
   Use utf8.ValidString(s) to check before sending.
   ```

## 无效尝试

- **** — This changes the API contract and may break compatibility. (60% 失败率)
- **** — This corrupts the data and may not be acceptable. (70% 失败率)
