# fastapi.exceptions.ResponseValidationError: 2 validation errors for UserResponse
id
  value is not a valid integer (type=type_error.integer)

- **ID:** `python/fastapi-response-validation-error`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The view returns data that does not conform to the declared response_model (wrong types, missing fields, or extra nested structure).

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Coerce in the view: `return UserResponse(id=int(user['id']), name=str(user['name']))` or use `.model_validate(user, from_attributes=True)`.
   ```
2. **** (90% success)
   ```
   Set `model_config = ConfigDict(from_attributes=True)` on the Pydantic model and return ORM objects directly.
   ```

## Dead Ends

- **** — Still logs ResponseValidationError; clients get opaque failures. (85% fail)
- **** — Loses OpenAPI schema and silently returns wrong shapes. (75% fail)
