# pydantic_core._pydantic_core.ValidationError: 1 validation error for User
  Extra inputs are not permitted [type=extra_forbidden, input_value='admin', input_type=str]

- **ID:** `python/pydantic-v2-extra-input-forbidden`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

In Pydantic v2, the default model_config no longer allows extra fields. Any key in the input dict that is not declared as a field triggers extra_forbidden.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 2.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Declare the field explicitly on the model:

class User(BaseModel):
    name: str
    role: str = 'user'
   ```
2. **** (90% success)
   ```
   If you intentionally want to accept unknown keys:

class User(BaseModel):
    model_config = ConfigDict(extra='ignore')
    name: str
   ```
3. **** (85% success)
   ```
   For dynamic keys, use a dict field:

class User(BaseModel):
    name: str
    metadata: dict[str, Any] = {}
   ```

## Dead Ends

- **** — The extra data is silently discarded, so downstream code that relies on it raises KeyError or AttributeError later. (70% fail)
- **** — Fields become untyped Any attributes; validation is skipped and IDE/type-checker support is lost, causing subtle runtime bugs. (55% fail)
- **** — Loses v2 performance, Rust core, and breaks other dependencies that require v2. (80% fail)
