# http: request body too large

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

## Root Cause

The incoming HTTP request body exceeds the server's maximum allowed size, often due to missing MaxBytesReader or server configuration.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   r.Body = http.MaxBytesReader(w, r.Body, 10<<20) // 10 MB limit
   ```
2. **** (80% success)
   ```
   if r.ContentLength > maxSize {
    http.Error(w, "Request body too large", http.StatusRequestEntityTooLarge)
    return
}
   ```

## Dead Ends

- **** — ReadBufferSize is not related to body size limits and will not prevent the error. (90% fail)
- **** — Simply increasing the limit may allow denial-of-service attacks. (50% fail)
