{
  "id": "python/starlette-route-order",
  "signature": "AssertionError: Route should be a string or a pathlib.Path",
  "signature_zh": "断言错误：路由应为字符串或 pathlib.Path",
  "regex": "AssertionError:\\ Route\\ should\\ be\\ a\\ string\\ or\\ a\\ pathlib\\.Path",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "在 Starlette 中定义了重复的路由，导致路由匹配混乱，或路由路径格式错误。",
  "root_cause_type": "generic",
  "root_cause_zh": "在 Starlette 中定义了重复的路由，导致路由匹配混乱，或路由路径格式错误。",
  "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.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "断言错误会导致应用启动失败。",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "添加路由时使用 '/path' 格式，例如 app.add_route('/home', home_page)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.7,
      "how": "from pathlib import Path; app.add_route(Path('/home'), home_page)",
      "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.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-11",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}