# TypeError: Object of type HTTPException is not JSON serializable

- **ID:** `python/fastapi-http-exception-detail-dict`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The route returns or embeds an HTTPException object in a response instead of raising it, so JSON encoding fails.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Raise it so FastAPI handles it:
raise HTTPException(status_code=404, detail='not found')
   ```
2. **** (85% success)
   ```
   Return a plain dict with the error shape you want.
   ```

## Dead Ends

- **** — Serializes the exception but returns 200 with error data instead of the proper status. (75% fail)
- **** — Loses status code and structured detail. (70% fail)
