# pydantic.errors.EnumError: 值不是有效的枚举成员

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

## 根因

类型为枚举的字段接收到未在枚举中定义的值。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Use enum member: Color.RED
   ```
2. **** (90% 成功率)
   ```
   Add custom validator to map strings to enum
   ```

## 无效尝试

- **** — Enum member type mismatch. (80% 失败率)
- **** — Pydantic expects the value, not name. (70% 失败率)
