{
  "id": "python/starlette-route-not-found",
  "signature": "starlette.exceptions.HTTPException: 404 Not Found",
  "signature_zh": "Starlette 异常：404 未找到",
  "regex": "starlette\\.exceptions\\.HTTPException:\\ 404\\ Not\\ Found",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "请求的 URL 路径与任何已定义的路由都不匹配，或使用了错误的方法（如 GET 而非 POST）。",
  "root_cause_type": "generic",
  "root_cause_zh": "请求的 URL 路径与任何已定义的路由都不匹配，或使用了错误的方法（如 GET 而非 POST）。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "根路径可能也没有定义路由，仍然会得到 404。",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "问题在于路由配置，忽略后无法访问目标资源。",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "from starlette.routing import Route\nasync def homepage(request):\n    return Response('Hello')\napp = Starlette(routes=[Route('/', homepage)])",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "from starlette.routing import Route\nasync def catch_all(request):\n    return JSONResponse({'error': 'not found'}, status_code=404)\napp = Starlette(routes=[Route('/{path:path}', catch_all)])",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}