{
  "id": "python/fastapi-httpexception-422-unprocessable-entity",
  "signature": "fastapi.exceptions.HTTPException: 422: Unprocessable Entity",
  "signature_zh": "fastapi.exceptions.HTTPException: 422: 无法处理的实体",
  "regex": "fastapi\\.exceptions\\.HTTPException:\\ 422:\\ Unprocessable\\ Entity",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Request body is well-formed but contains semantic errors, like invalid data types.",
  "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": "Sending numbers as strings without conversion",
      "why_fails": "Pydantic may not auto-convert if strict mode is on.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Missing required fields in nested models",
      "why_fails": "Validation fails at nested level.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use Pydantic's conint or constr for validation",
      "success_rate": 0.9,
      "how": "from pydantic import BaseModel, conint\nclass Item(BaseModel):\n    age: conint(gt=0, lt=150)  # valid integer",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add custom validators",
      "success_rate": 0.85,
      "how": "from pydantic import validator\nclass Item(BaseModel):\n    name: str\n    @validator('name')\n    def name_must_be_alpha(cls, v):\n        if not v.isalpha():\n            raise ValueError('must be alphabetic')\n        return v",
      "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": "2024-09-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}