# ValueError: 无效的表单数据：期望字节，得到字符串

- **ID:** `python/starlette-request-form-data-error`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

表单数据未正确编码或请求体解析不正确。

## 版本兼容性

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

## 解决方案

1. **** (100% 成功率)
   ```
   Use await request.form() correctly to parse the form data.
   ```
2. **** (90% 成功率)
   ```
   Ensure the client sends proper content-type: application/x-www-form-urlencoded or multipart/form-data.
   ```

## 无效尝试

- **** — Some fields may be binary or multi-encoded, causing errors. (60% 失败率)
- **** — This is a common mistake; the method must be awaited. (80% 失败率)
