# pydantic_core._pydantic_core.ValidationError：1 个验证错误（RootModel[list[Item]]）
  输入应为有效的列表 [type=list_type, input_value={'a': 1}, input_type=dict]

- **ID:** `python/pydantic-rootmodel-list`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

RootModel[list[...]] 接收到了一个 dict。在 v2 中 RootModel 直接包装根值，因此输入必须是列表本身，而不是 {'root': [...]}。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 2.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   from pydantic import RootModel
Items = RootModel[list[Item]]
Items.model_validate([{'a': 1}])
   ```
2. **** (90% 成功率)
   ```
   from pydantic import TypeAdapter
ta = TypeAdapter(list[Item])
ta.validate_python([{'a': 1}])
   ```

## 无效尝试

- **** — v2 removed the implicit 'root' key; the model now expects the bare value. (70% 失败率)
- **** — __root__ is a v1 feature and raises PydanticUserError under v2. (75% 失败率)
- **** — Loses Pydantic validation and serialization hooks. (50% 失败率)
