{
  "id": "python/pydantic-model-config-attribute-error",
  "signature": "AttributeError: type object 'User' has no attribute 'Config'. Did you mean: 'model_config'?",
  "signature_zh": "AttributeError: 类型对象 'User' 没有属性 'Config'。您是想找 'model_config' 吗？",
  "regex": "AttributeError:\\ type\\ object\\ 'User'\\ has\\ no\\ attribute\\ 'Config'\\.\\ Did\\ you\\ mean:\\ 'model_config'\\?",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Pydantic v1 code using an inner class Config was copied into a v2 project. In v2 the configuration is set via the model_config class attribute with ConfigDict.",
  "root_cause_type": "generic",
  "root_cause_zh": "将 Pydantic v1 中使用内部 class Config 的代码复制到了 v2 项目中。v2 中配置通过 model_config 类属性和 ConfigDict 设置。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Pydantic v2 ignores the inner Config class entirely; settings silently have no effect and behavior diverges.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Breaks other v2-only dependencies and pydantic-core bindings; causes cascading import errors across the project.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "from pydantic import BaseModel, ConfigDict\n\nclass User(BaseModel):\n    model_config = ConfigDict(extra='forbid', frozen=True)\n    name: str",
      "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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}