{
  "id": "python/fastapi-multiple-body-parameters",
  "signature": "fastapi.exceptions.FastAPIError: Invalid args for response field",
  "signature_zh": "FastAPI 错误：响应字段的参数无效。",
  "regex": "fastapi\\.exceptions\\.FastAPIError:\\ Invalid\\ args\\ for\\ response\\ field",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Using multiple body parameters without embedding them in a single Pydantic model.",
  "root_cause_type": "generic",
  "root_cause_zh": "在未将多个 body 参数嵌入单个 Pydantic 模型的情况下使用它们。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "FastAPI expects a single body; multiple params cause confusion.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Loses validation and type safety.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "class Item(BaseModel):\n    name: str\n    price: float\n\n@app.post('/item')\nasync def create(item: Item):\n    return item",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Use Body(embed=True) for a single param: async def create(item: str = Body(embed=True))",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}