Chrome DevTools: net::ERR_CONTENT_LENGTH_MISMATCH — body shorter than the Content-Length header
The server promised a number of bytes in Content-Length and sent a different number, so Chrome treats the download as corrupted.
Content-Length mismatch Meaning
Classic causes are code that changes the body after the header was written (compression, a BOM, a trailing echo), a proxy/CDN truncating the response, a file being modified while served, and full-disk errors. Compare the header with the real byte count using curl.
Common causes
- Script outputs extra bytes or modifies the body after headers were sent
- Compression or minify layer changing size without updating the header
- Proxy/CDN cutting the response (timeout, buffer, disk full)
- File replaced or truncated during download
- Wrong
Content-Lengthset manually
⚡ Quick fix
- Do not set
Content-Lengthyourself when output is compressed or generated - Compare:
curl -sIContent-Length vscurl -s | wc -c - Fix proxy limits/disk space
Detailed fix by platform
Linux
curl -s https://example.com/file | wc -candcurl -sI https://example.com/file | grep -i content-length
PHP
- Remove manual
header('Content-Length: …')afterob_start('ob_gzhandler'); avoid output beforereadfile()
Nginx
- Check
gzipandsub_filterinterplay andproxy_buffering, and disk space forproxy_temp_path
How to diagnose
- Numbers — Header size vs real bytes?
- Path — Direct to origin or through a proxy?
- Change — Does content change while being served?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Browser
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 15 Oct 2026