# error: http: response body too large

- **ID:** `go/net-http-response-body-too-large`
- **Domain:** go
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The HTTP response body exceeds the maximum allowed size, typically due to server sending large data without proper limits.

## Version Compatibility

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

## Workarounds

1. **Use io.LimitReader to cap response size** (95% success)
   ```
   maxSize := int64(10 << 20) // 10 MB
body, err := io.ReadAll(io.LimitReader(resp.Body, maxSize))
if err != nil { return err }
if int64(len(body)) == maxSize { /* handle truncation */ }
   ```

## Dead Ends

- **Reading entire body into memory** — May cause out-of-memory; use io.LimitReader. (80% fail)
