{
  "id": "python/pydantic-config-and-fields-deprecated",
  "signature": "pydantic.errors.PydanticUserError: `Config` and `fields` are deprecated in Pydantic V2. Use `model_config` and `Field` instead. See https://docs.pydantic.dev/2.0/migration/",
  "signature_zh": "pydantic.errors.PydanticUserError：Pydantic V2 已弃用 `Config` 和 `fields`。请改用 `model_config` 和 `Field`。参见 https://docs.pydantic.dev/2.0/migration/",
  "regex": "pydantic\\.errors\\.PydanticUserError:\\ `Config`\\ and\\ `fields`\\ are\\ deprecated\\ in\\ Pydantic\\ V2\\.\\ Use\\ `model_config`\\ and\\ `Field`\\ instead\\.\\ See\\ https://docs\\.pydantic\\.dev/2\\.0/migration/",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "A v1-style inner class Config or fields dict was used in a model under Pydantic v2.",
  "root_cause_type": "generic",
  "root_cause_zh": "在 Pydantic v2 的模型中使用了 v1 风格的内嵌 Config 类或 fields 字典。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "No such switch exists; pydantic 2.x always rejects v1 config.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Blocks upgrades of FastAPI and other deps that require v2.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The error is raised at class definition time, not import time, and cannot be caught usefully.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "from pydantic import BaseModel, ConfigDict\nclass M(BaseModel):\n    model_config = ConfigDict(orm_mode=True)  # was class Config: orm_mode = True\n    x: int",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "pip install bump-pydantic\nbump-pydantic ./src",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}