Malformed chunked encoding (invalid chunk size / premature end)
The body claims to use chunked transfer encoding, but the chunk sizes or terminator are wrong.
Invalid chunk sizecurl: (56) Malformed encoding found in chunked-encodingParse Error: Invalid character in chunk size Meaning
A proxy, app or buggy framework wrote bad chunk framing, or the connection closed before the final 0\r
\r
chunk. Clients report invalid chunk size or incomplete chunked encoding. Fix the component that generates the body, update the proxy, and avoid mixing manual Content-Length with chunking.
Common causes
- Application sent invalid chunk framing
- Connection closed before the last chunk
- Proxy buffering or truncating the stream
- Manually set Content-Length plus chunked
- Compression middleware bug
⚡ Quick fix
- Capture the response with
curl -v --raw - Update the proxy/framework generating the body
- Don't set Content-Length when streaming chunked
Detailed fix by platform
cURL
curl -sv --raw https://example.com/stream | head -c 400
How to diagnose
- Chunk sizes — Valid hex?
- Final chunk — Sent?
- Layer — Which component?
🔧 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 HTTP
Other ways to find it
Where this error sits
Origin: Network. 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 18 Nov 2026