{
  "id": "python/pydantic-config-extra-forbid",
  "signature": "pydantic.errors.ConfigError: 'extra' must be a string or dict",
  "signature_zh": "pydantic.errors.ConfigError: 'extra' 必须是字符串或字典",
  "regex": "pydantic\\.errors\\.ConfigError:\\ 'extra'\\ must\\ be\\ a\\ string\\ or\\ dict",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "In Pydantic v2, the 'extra' config option only accepts specific string values ('allow', 'ignore', 'forbid') or a dict, not a boolean or arbitrary string.",
  "root_cause_type": "generic",
  "root_cause_zh": "在 Pydantic v2 中，'extra' 配置选项只接受特定字符串值（'allow'、'ignore'、'forbid'）或字典，不接受布尔值或任意字符串。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Boolean values are not valid for 'extra' in v2; it requires string or dict, leading to ConfigError.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "'extra' does not accept a list; it must be a string or dict, so this raises ConfigError.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Set extra='forbid' or 'allow' in model config: class Model(BaseModel): model_config = ConfigDict(extra='forbid')",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Use a dict to customize extra fields: model_config = ConfigDict(extra={'field': 'value'})",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}