{
  "id": "python/fastapi-http-exception-custom",
  "signature": "fastapi.HTTPException: 500 Internal Server Error: An internal error occurred",
  "signature_zh": "FastAPI HTTP 异常：500 内部服务器错误：发生内部错误",
  "regex": "fastapi\\.HTTPException:\\ 500\\ Internal\\ Server\\ Error:\\ An\\ internal\\ error\\ occurred",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "在端点函数中抛出了未捕获的异常，FastAPI 默认返回 500 错误。",
  "root_cause_type": "generic",
  "root_cause_zh": "在端点函数中抛出了未捕获的异常，FastAPI 默认返回 500 错误。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "如果错误是系统性的，重试仍会失败。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "关闭调试模式不会修复根本问题，只是隐藏错误信息。",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "@app.exception_handler(Exception)\nasync def handle_exc(request, exc):\n    return JSONResponse({'error': 'internal'}, status_code=500)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "try:\n    ...\nexcept ValueError:\n    raise HTTPException(400, 'bad value')",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-14",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}