# INTERNAL: grpc: 状态详情被截断: 收到 4096 字节但预期 8192 字节

- **ID:** `grpc/status-details-truncated`
- **领域:** grpc
- **类别:** protocol_error
- **错误码:** `ESTATUSTRUNC`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

响应尾部中的 gRPC 状态详情超过了配置的最大接收消息大小，导致截断并引发内部错误。

## 版本兼容性

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

## 解决方案

1. ```
   Increase the client's max receive message size to accommodate larger status details: `channel = grpc.insecure_channel(target, options=[('grpc.max_receive_message_length', 16 * 1024 * 1024)])`
   ```
2. ```
   On the server side, reduce the size of status details by using concise error messages or splitting details across multiple RPCs.
   ```
3. ```
   If using gRPC-Web, configure the proxy to increase the max trailer size (e.g., Envoy's `max_request_headers_kb`).
   ```

## 无效尝试

- **Increasing the client's max send message size to match the expected size.** — The error is about receiving, not sending; max send size controls outgoing payloads, not incoming trailers. (90% 失败率)
- **Setting the environment variable GRPC_VERBOSITY=DEBUG to get more details.** — Verbose logging does not resolve protocol-level truncation; it only adds noise. (95% 失败率)
- **Reducing the number of fields in the status details on the server side without checking max receive size.** — If the max receive size is too small, even a single large detail can cause truncation; the fix must target the limit. (50% 失败率)
