# starlette.websockets.WebSocketDisconnect: 1000

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

## Root Cause

Client closed the WebSocket while the server was awaiting receive_text/receive_json.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   try:\n    msg = await ws.receive_text()\nexcept WebSocketDisconnect:\n    return
   ```
2. **** (92% success)
   ```
   try:\n    while True: ...\nfinally:\n    await manager.disconnect(ws)
   ```

## Dead Ends

- **** — Socket is closed; next receive raises again immediately. (85% fail)
- **** — Does not prevent application-level disconnects. (80% fail)
