{
  "id": "python/fastapi-query-parameter-type-error",
  "signature": "fastapi.exceptions.RequestValidationError: 1 validation error for Request\nquery -> page\n  value is not a valid integer (type=type_error.integer)",
  "signature_zh": "FastAPI 请求验证错误：查询参数 'page' 不是有效的整数",
  "regex": "fastapi\\.exceptions\\.RequestValidationError:\\ 1\\ validation\\ error\\ for\\ Request\\\nquery\\ \\->\\ page\\\n\\ \\ value\\ is\\ not\\ a\\ valid\\ integer\\ \\(type=type_error\\.integer\\)",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "客户端提供的查询参数 'page' 无法转换为整数类型",
  "root_cause_type": "generic",
  "root_cause_zh": "客户端提供的查询参数 'page' 无法转换为整数类型",
  "versions": [
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "将参数类型改为 str 并手动转换",
      "why_fails": "失去了自动验证功能，可能引入其他错误",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "在客户端忽略类型检查",
      "why_fails": "服务器端仍然会验证并返回错误",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "提供有效的整数值",
      "success_rate": 0.95,
      "how": "GET /items?page=1",
      "condition": "",
      "sources": []
    },
    {
      "action": "使用 Query 设置默认值",
      "success_rate": 0.9,
      "how": "from fastapi import Query\n@app.get('/items')\ndef get_items(page: int = Query(1, ge=1)):\n    ...",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-03-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}