{
  "id": "python/fastapi-http-exception-detail-dict",
  "signature": "TypeError: Object of type HTTPException is not JSON serializable",
  "signature_zh": "TypeError: HTTPException 类型的对象无法 JSON 序列化",
  "regex": "TypeError:\\ Object\\ of\\ type\\ HTTPException\\ is\\ not\\ JSON\\ serializable",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The route returns or embeds an HTTPException object in a response instead of raising it, so JSON encoding fails.",
  "root_cause_type": "generic",
  "root_cause_zh": "路由将 HTTPException 对象返回或嵌入响应，而不是抛出它，导致 JSON 编码失败。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Serializes the exception but returns 200 with error data instead of the proper status.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Loses status code and structured detail.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Raise it so FastAPI handles it:\nraise HTTPException(status_code=404, detail='not found')",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Return a plain dict with the error shape you want.",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-28",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}