{
  "id": "python/fastapi-response-model-error",
  "signature": "fastapi.exceptions.FastAPIError: Invalid args for response field",
  "signature_zh": "FastAPI错误：响应字段的参数无效",
  "regex": "fastapi\\.exceptions\\.FastAPIError:\\ Invalid\\ args\\ for\\ response\\ field",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The response_model parameter is set to an invalid type or contains fields that cannot be serialized.",
  "root_cause_type": "generic",
  "root_cause_zh": "response_model参数设置为无效类型或包含无法序列化的字段。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Setting response_model to a dict without specifying keys can cause unexpected output.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Removing response_model entirely returns all fields, potentially leaking sensitive data.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Define a Pydantic model for the response: class ItemResponse(BaseModel):\\n    name: str\\n    price: float\\nThen use response_model=ItemResponse.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Use response_model_exclude_unset=True to only include fields that were set.",
      "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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}