{
  "id": "python/fastapi-request-validation-error-missing-field",
  "signature": "fastapi.exceptions.RequestValidationError: 422 Unprocessable Entity",
  "signature_zh": "FastAPI请求验证错误：422 无法处理的实体",
  "regex": "fastapi\\.exceptions\\.RequestValidationError:\\ 422\\ Unprocessable\\ Entity",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Request body or query parameters do not match the expected Pydantic model schema, such as missing required fields or incorrect types.",
  "root_cause_type": "generic",
  "root_cause_zh": "请求体或查询参数与预期的Pydantic模型架构不匹配，例如缺少必填字段或类型错误。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Catching the exception globally and returning a generic 400 hides the specific field issues, making debugging harder.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Disabling validation with model_config = {'extra': 'allow'} can allow invalid data through, causing downstream errors.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Define a custom exception handler: @app.exception_handler(RequestValidationError)\\nasync def validation_exception_handler(request, exc):\\n    return JSONResponse(status_code=422, content={\"detail\": exc.errors()})",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Use Pydantic's Field(..., description='...') to document requirements and ensure clients send correct data.",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}