# starlette.requests.ClientDisconnect: Client disconnected

- **ID:** `python/starlette-jsondecodeerror`
- **Domain:** python
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The client closed the connection before the server could read the full request body.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 0.30.x | active | — | — |
| 0.40.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   try:
    await request.json()
except ClientDisconnect:
    return JSONResponse(status_code=499, content={'detail': 'Client disconnected'})
   ```
2. **** (85% success)
   ```
   async for chunk in request.stream():
    if await request.is_disconnected():
        break
   ```

## Dead Ends

- **** — Client already disconnected; timeout doesn't help. (80% fail)
- **** — May cause duplicate operations if not idempotent. (60% fail)
