# http: invalid Content-Length

- **ID:** `go/http-multiple-content-length`
- **Domain:** go
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The HTTP request or response contains multiple Content-Length headers with different values, causing Go's net/http to reject it as invalid.

## Version Compatibility

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

## Workarounds

1. **** (75% success)
   ```
   if req.Header.Get("Content-Length") != "" {
    // Validate and use a single value
} else {
    // Handle missing Content-Length
}
   ```
2. **** (80% success)
   ```
   Use a custom RoundTripper to sanitize headers before sending.
   ```

## Dead Ends

- **** — The body may be corrupted or incomplete, leading to data integrity issues. (80% fail)
- **** — Does not resolve the underlying inconsistency and may cause parsing errors. (60% fail)
