{
  "id": "python/starlette-route-parameter-type",
  "signature": "ValueError: Invalid value for path parameter 'id': expected int, got 'abc'",
  "signature_zh": "值错误：路径参数'id'的值无效：期望整数，得到'abc'。",
  "regex": "ValueError:\\ Invalid\\ value\\ for\\ path\\ parameter\\ 'id':\\ expected\\ int,\\ got\\ 'abc'",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "路径参数类型转换失败，例如期望整数但提供了字符串。",
  "root_cause_type": "generic",
  "root_cause_zh": "路径参数类型转换失败，例如期望整数但提供了字符串。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "尝试使用int()强制转换但未捕获异常。",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "忽略错误，导致路由匹配失败。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "使用类型转换装饰器：\n@app.route(\"/items/{id}\")\nasync def get_item(request, id: int):\n    return {\"id\": id}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "手动转换并处理错误：\ntry:\n    id = int(request.path_params['id'])\nexcept ValueError:\n    return JSONResponse(status_code=400, content={\"error\": \"Invalid id\"})",
      "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": "2026-05-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}