# http: request body already closed

- **ID:** `go/http-request-body-already-closed`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Attempting to read from or close an http.Request.Body that has already been closed, typically due to double-close or reading after the handler has returned.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.21 | active | — | — |
| 1.22 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   if body, err := io.ReadAll(r.Body); err == nil { r.Body.Close() }
   ```
2. **** (90% success)
   ```
   defer r.Body.Close() once at start of handler
   ```

## Dead Ends

- **** — Silently ignoring leads to incomplete reads and potential data corruption (80% fail)
- **** — Request body is a stream and cannot be reopened; must be buffered upfront if multiple reads needed (90% fail)
