{
  "id": "python/pydantic-rootmodel-list",
  "signature": "pydantic_core._pydantic_core.ValidationError: 1 validation error for RootModel[list[Item]]\n  Input should be a valid list [type=list_type, input_value={'a': 1}, input_type=dict]",
  "signature_zh": "pydantic_core._pydantic_core.ValidationError：1 个验证错误（RootModel[list[Item]]）\n  输入应为有效的列表 [type=list_type, input_value={'a': 1}, input_type=dict]",
  "regex": "pydantic_core\\._pydantic_core\\.ValidationError:\\ 1\\ validation\\ error\\ for\\ RootModel\\[list\\[Item\\]\\]\\\n\\ \\ Input\\ should\\ be\\ a\\ valid\\ list\\ \\[type=list_type,\\ input_value=\\{'a':\\ 1\\},\\ input_type=dict\\]",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "A RootModel[list[...]] received a dict. In v2, RootModel wraps the root value directly, so the input must be the list itself, not {'root': [...]}.",
  "root_cause_type": "generic",
  "root_cause_zh": "RootModel[list[...]] 接收到了一个 dict。在 v2 中 RootModel 直接包装根值，因此输入必须是列表本身，而不是 {'root': [...]}。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "v2 removed the implicit 'root' key; the model now expects the bare value.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "__root__ is a v1 feature and raises PydanticUserError under v2.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Loses Pydantic validation and serialization hooks.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "from pydantic import RootModel\nItems = RootModel[list[Item]]\nItems.model_validate([{'a': 1}])",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "from pydantic import TypeAdapter\nta = TypeAdapter(list[Item])\nta.validate_python([{'a': 1}])",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-14",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}