# fastapi.exceptions.RequestValidationError: Request 出现 1 个验证错误
query -> ids.0
  值不是有效的整数 (type=type_error.integer)

- **ID:** `python/fastapi-query-param-list-parsing`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

客户端发送了重复查询参数（ids=1&ids=2），但端点声明 ids: List[int] 使用了旧版 FastAPI，或使用了不被解析的 ids[]=1。

## 版本兼容性

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

## 解决方案

1. **** (92% 成功率)
   ```
   Declare ids: List[int] = Query(default=[]) and send ids=1&ids=2
   ```
2. **** (88% 成功率)
   ```
   Use a JSON body model with ids: List[int] instead of query params
   ```

## 无效尝试

- **** — Loses validation and OpenAPI schema. (55% 失败率)
- **** — FastAPI does not strip brackets by default. (70% 失败率)
