# RuntimeError: Response content longer than Content-Length

- **ID:** `python/starlette-response-content-length`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The response body size doesn't match the Content-Length header, often due to manual header setting.

## Version Compatibility

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

## Workarounds

1. **** (100% success)
   ```
   Don't set Content-Length manually; let Response handle it: return Response(content=body)
   ```
2. **** (90% success)
   ```
   If you must set it, compute len(body) and set header accordingly
   ```

## Dead Ends

- **** — If the body changes, the length becomes stale; better to let Starlette compute it. (80% fail)
- **** — Starlette may still check; you need to ensure the stream sends exactly the right bytes. (60% fail)
