{
  "id": "python/django-url-parameter-type",
  "signature": "TypeError at /api/users/abc/ Expected 'int' but received 'str'",
  "signature_zh": "类型错误：期望整数但收到字符串",
  "regex": "TypeError\\ at\\ /api/users/abc/\\ Expected\\ 'int'\\ but\\ received\\ 'str'",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "URL 路径参数未转换为整数，而视图期望整数类型",
  "root_cause_type": "generic",
  "root_cause_zh": "Django URL 路径参数默认为字符串，但视图函数要求整数",
  "versions": [
    {
      "version": "3.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "在视图中用 int() 强制转换",
      "why_fails": "如果字符串不是数字，int() 会抛出 ValueError",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "修改 URL 模式使用字符串类型",
      "why_fails": "可能破坏其他依赖整数的逻辑",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "在 URL 模式中使用 int 转换器",
      "success_rate": 1.0,
      "how": "path('users/<int:id>/', views.user_detail)",
      "condition": "",
      "sources": []
    },
    {
      "action": "在视图中安全转换",
      "success_rate": 0.9,
      "how": "def user_detail(request, id): id = int(id) if isinstance(id, str) else 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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}