# 类型错误：'NoneType' 对象不可迭代。

- **ID:** `python/fastapi-query-param-type-conflict`
- **领域:** python
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

查询参数定义为默认 None，但在未检查的情况下用于迭代。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Use Optional[List[str]] = Query(None) and then if items: for item in items:
   ```
2. **** (90% 成功率)
   ```
   Use list = Query(default_factory=list) to ensure always iterable
   ```

## 无效尝试

- **** — May still miss cases where param is empty list. (60% 失败率)
- **** — Mutable default arguments are shared across requests, causing bugs. (80% 失败率)
