# TypeError: Multiple body parameters are not allowed when using Pydantic models.

- **ID:** `python/fastapi-multiple-body-params`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

FastAPI路由中定义了多个Pydantic模型作为body参数，但HTTP请求只能有一个body。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **将多个模型合并为一个嵌套模型** (95% success)
   ```
   class Item(BaseModel): name: str; class User(BaseModel): username: str; class Combined(BaseModel): item: Item; user: User; @app.post('/create') async def create(data: Combined): return data
   ```
2. **使用Body参数分别标注** (90% success)
   ```
   from fastapi import Body; @app.post('/create') async def create(item: Item = Body(...), user: User = Body(...)): return {'item': item, 'user': user}
   ```

## Dead Ends

- **尝试合并模型但忽略字段冲突** — 合并后字段名冲突。 (60% fail)
- **使用多个非模型参数（如str）作为body** — FastAPI会将多个参数视为查询参数。 (70% fail)
