{
  "id": "python/fastapi-http-exception-handler-missing",
  "signature": "fastapi.exceptions.HTTPException: 500 Internal Server Error",
  "signature_zh": "FastAPI HTTP 异常：500 内部服务器错误",
  "regex": "fastapi\\.exceptions\\.HTTPException:\\ 500\\ Internal\\ Server\\ Error",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "FastAPI 应用未处理未捕获的异常，导致返回 500 错误",
  "root_cause_type": "generic",
  "root_cause_zh": "FastAPI 应用未处理未捕获的异常，导致返回 500 错误",
  "versions": [
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "在路径操作中使用 try-except 但不记录日志",
      "why_fails": "错误被隐藏，难以调试",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "返回空响应而不提供错误信息",
      "why_fails": "客户端无法知道错误原因",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "添加全局异常处理器",
      "success_rate": 0.95,
      "how": "@app.exception_handler(Exception)\nasync def global_exception_handler(request, exc):\n    return JSONResponse(status_code=500, content={'detail': '内部错误'})",
      "condition": "",
      "sources": []
    },
    {
      "action": "使用中间件捕获未处理异常",
      "success_rate": 0.9,
      "how": "@app.middleware('http')\nasync def catch_exceptions(request, call_next):\n    try:\n        return await call_next(request)\n    except Exception:\n        return JSONResponse(status_code=500, content={'detail': '错误'})",
      "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": "2025-06-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}