{
  "id": "python/flask-route-param-type-error",
  "signature": "werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: KeyError: 'id'",
  "signature_zh": "错误请求：400 错误请求：KeyError: 'id'。",
  "regex": "werkzeug\\.exceptions\\.BadRequestKeyError:\\ 400\\ Bad\\ Request:\\ KeyError:\\ 'id'",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "在路由或请求中尝试访问不存在的参数 `id`。",
  "root_cause_type": "generic",
  "root_cause_zh": "在路由或请求中尝试访问不存在的参数 `id`。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "尝试使用 `request.args['id']` 但未捕获 KeyError，导致错误。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "尝试在模板中使用 `request.args.get('id')` 但未处理 None。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "使用 `request.args.get('id')` 并检查是否为 None。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "在路由参数中声明 `@app.route('/<int: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-02-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}