# HTTP/1.1 422 Unprocessable Entity
{"detail":[{"loc":["body","age"],"msg":"value is not a valid integer","type":"type_error.integer"}]}

- **ID:** `python/fastapi-422-unprocessable-entity`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Client sent a value whose type does not match the Pydantic field (e.g., string for int, null for non-optional).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 0.100.x | active | — | — |
| 0.110.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Use `age: int = Field(..., ge=0)` and document; client should send `{"age": 30}` not `{"age": "30"}` unless using `model_config = ConfigDict(coerce_numbers_to_str=False)` with custom validator.
   ```
2. **** (90% success)
   ```
   Add a custom validator: `@field_validator('age', mode='before') def coerce(cls, v): return int(v)`
   ```

## Dead Ends

- **** — Validation runs before the handler; decorator status does not apply. (90% fail)
- **** — Hides the real cause; clients still send wrong types. (70% fail)
