{
  "id": "python/fastapi-pydantic-v1-v2-migration",
  "signature": "TypeError: BaseModel.__init__() takes 1 positional argument but 2 were given",
  "signature_zh": "TypeError: BaseModel.__init__() 只接受 1 个位置参数，但给出了 2 个",
  "regex": "TypeError:\\ BaseModel\\.__init__\\(\\)\\ takes\\ 1\\ positional\\ argument\\ but\\ 2\\ were\\ given",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Pydantic v1 code calling a v2 model with positional args, or using v1-only APIs like .dict() vs .model_dump().",
  "root_cause_type": "generic",
  "root_cause_zh": "Pydantic v1 代码以位置参数调用 v2 模型，或使用了仅 v1 支持的 API（如 .dict() 而 v2 应为 .model_dump()）。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "FastAPI 0.100+ requires pydantic v2; other deps break.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Does not address .dict/.json API changes elsewhere.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.94,
      "how": "item = Item(name='x')\ndata = item.model_dump()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "from pydantic.v1 import BaseModel",
      "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-07-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}