# aiohttp.client_exceptions.ClientPayloadError: 响应负载未完成

- **ID:** `python/aiohttp-clientpayloaderror`
- **领域:** python
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

服务器在响应体中间关闭了连接，或响应体被读取两次，或流式传输被中断。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (92% 成功率)
   ```
   Read the body once and cache:

async with session.get(url) as resp:
    body = await resp.read()
    data = json.loads(body)
   ```
2. **** (88% 成功率)
   ```
   Retry the request on ClientPayloadError with backoff.
   ```
3. **** (85% 成功率)
   ```
   Use resp.content.iter_chunked() for large payloads to detect partial reads early.
   ```

## 无效尝试

- **** — The body is consumed once; second call raises the same error. (90% 失败率)
- **** — The connection is already closed; timeout doesn't matter. (85% 失败率)
- **** — Server-side framing, not client-controlled. (90% 失败率)
