# starlette.exceptions.HTTPException: 500 Internal Server Error

- **ID:** `python/starlette-http-exception-handling`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

服务器内部发生未捕获的异常，导致 500 错误。

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   @app.exception_handler(Exception)
async def exception_handler(request, exc):
    return JSONResponse(status_code=500, content={'message': 'Internal Server Error'})
   ```

## Dead Ends

- **** — 会掩盖真实错误，导致调试困难 (80% fail)
- **** — 会导致状态不一致，且可能崩溃 (90% fail)
