{
  "id": "python/fastapi-http-exception-404-not-found",
  "signature": "fastapi.exceptions.HTTPException: 404: Not Found",
  "signature_zh": "fastapi.exceptions.HTTPException: 404: 未找到",
  "regex": "fastapi\\.exceptions\\.HTTPException:\\ 404:\\ Not\\ Found",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Requested URL path does not match any defined route in the FastAPI application.",
  "root_cause_type": "generic",
  "root_cause_zh": "请求的 URL 路径与 FastAPI 应用中定义的任何路由不匹配。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding a catch-all route that returns 200",
      "why_fails": "Masks real errors and may cause unintended behavior.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Assuming trailing slash mismatch",
      "why_fails": "FastAPI by default does not redirect, so /users and /users/ are different.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check and correct the route definition",
      "success_rate": 0.95,
      "how": "@app.get('/items/{item_id}')\nasync def read_item(item_id: int):\n    return {'item_id': item_id}\n# Access /items/123, not /items/",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a custom 404 handler for better debugging",
      "success_rate": 0.9,
      "how": "@app.exception_handler(404)\nasync def not_found_handler(request, exc):\n    return JSONResponse(status_code=404, content={'message': 'Route not found'})",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}