Views: 10

ERR_INVALID_CHUNKED_ENCODING: Fix Broken Framing

ERR_INVALID_CHUNKED_ENCODING: the server's chunk framing is malformed, not truncated. Find double-chunking or stray output. Free instant check, no sign-up.

Check your domain for this issue now

Free, no sign-up. Runs the exact check this guide describes and shows what to fix.

Problem

Chrome’s console shows net::ERR_INVALID_CHUNKED_ENCODING, often alongside a 200 (OK) status, and the page renders blank or half-broken. The server did respond — the status line and headers arrived — but the body was framed as a chunked stream that Chrome couldn’t parse. This is not a truncated response that got cut short. The bytes describing the chunks are themselves wrong.

Symptoms

  • The console shows net::ERR_INVALID_CHUNKED_ENCODING, frequently paired with a 200 (OK) that makes it look like the request succeeded.
  • The page is blank or missing content; JavaScript and CSS may load truncated, breaking form submissions and dynamic behavior.
  • The response headers include Transfer-Encoding: chunked.
  • It fails consistently on the same endpoint — not the intermittent, size-dependent flakiness of a truncated stream.
  • The same URL may render fine in curl or a more lenient browser, which makes it look like a Chrome bug.

What This Error Actually Means

When a server sends a body without knowing its length up front, HTTP/1.1 uses chunked transfer coding (RFC 9112 §7.1). The body is a sequence of chunks, and each chunk has a strict shape: a line giving the chunk’s size in hexadecimal, a CRLF, the chunk data, another CRLF, then the next chunk — until a final zero-length chunk (0\r\n\r\n) marks the end. The size lines are the scaffolding that tells the client where each chunk begins and ends.

ERR_INVALID_CHUNKED_ENCODING (Chromium net error -270) is Chrome saying that scaffolding is broken. Somewhere in the stream it expected a hexadecimal size line and got something that doesn’t parse — a non-hex character, a missing CRLF, a size that doesn’t line up with the bytes that follow, or garbage injected between chunks. Chrome parses this grammar strictly and does not try to recover; it aborts.

The distinction that matters: this is not ERR_INCOMPLETE_CHUNKED_ENCODING, where the chunks are valid and the stream just ends early. Here the chunks are malformed. The response didn’t run out — it was mis-assembled. That points you at whatever wrote the framing: the application, a framework’s HTTP layer, or a proxy that re-touched the body without fixing the sizes.

Top 3 Causes

  1. Double or conflicting framing. The response carries both a Content-Length and Transfer-Encoding: chunked, or something in the path chunks a body that was already chunked. Per RFC 9112 §6.1 chunked wins and the length must be dropped, but a hand-rolled HTTP layer that writes its own chunk markers and lets the server chunk again produces byte sequences that no longer parse as valid chunks. This is the classic cause behind frameworks and runtimes that emit their own chunk sizes incorrectly.
  2. Stray bytes corrupting the size lines. A chunk starts with a hex size and a CRLF, and nothing is allowed to appear outside that structure. If the application prints anything into the stream that the framer doesn’t account for — a PHP notice or warning echoed mid-response, whitespace or a newline after a closing ?>, a UTF-8 BOM prepended by an editor, stray debug output — the byte offsets shift and the next “size line” Chrome reads is no longer valid hex. The framing is arithmetically off from the first injected byte onward.
  3. A middlebox rewriting the body without re-framing. A compression proxy, a WAF, or a TLS-inspection appliance that mutates the entity body — injecting a script, stripping content, altering encoding — but doesn’t recompute the chunk sizes leaves the declared sizes inconsistent with the actual bytes. The origin framed the response correctly; the device in the middle broke it.

Diagnose with DechoNet

  • HTTP Check fetches the URL from our servers, outside your browser and your local network, and shows you the response headers and status. If it confirms Transfer-Encoding: chunked and the response is malformed from there too, the fault is at the origin or an upstream proxy — not your browser, extensions, or local security software.
  • If the external fetch comes back clean but your browser still fails, the framing is being broken on your side of the connection: a local proxy, antivirus web shielding, or a corporate TLS-inspection appliance mutating the body. That narrows the search to your machine and network path immediately.
  • Because this failure is deterministic, one external fetch is enough to settle server-vs-client — you don’t need to hammer it the way you would an intermittent truncation.

Resolution Checklist

  • Confirm it’s chunked, not fixed-length. Check the response headers for Transfer-Encoding: chunked. If you see Content-Length with no chunked encoding, you’re looking at ERR_CONTENT_LENGTH_MISMATCH instead — a different framing bug.
  • Look at the raw wire, not the rendered page. Run curl --raw -v against the URL and read the literal chunk-size lines. Malformed hex, a stray blank line, or a BOM at the top of the body will be visible here in a way it never is in DevTools.
  • Kill double-framing. Make sure your app or framework isn’t writing its own chunk markers while the server also applies Transfer-Encoding: chunked, and that no response carries both Content-Length and chunked. Pick one framing and let a single layer own it.
  • Hunt stray output. Check for PHP notices/warnings printed into the body, whitespace or newlines after ?>, an editor-added UTF-8 BOM, or debug echo/print statements leaking into the response stream. Any byte outside the chunk structure corrupts it.
  • Suspect the middle if the origin looks fine. If the application emits valid framing in isolation but the browser sees garbage, a proxy, WAF, compression layer, or TLS-inspection device is rewriting the body without fixing the sizes. Test with it bypassed.
  • Isolate client vs. server. Fetch the URL with an external HTTP Check or curl --raw from another network. Reproduces externally → fix the origin or upstream proxy. Only fails in your browser → look at local proxies, corporate MITM, or antivirus.

When to Escalate

  • If the raw response looks correctly framed from the origin but a CDN or edge in front of it serves malformed chunks, escalate to whoever owns that edge — the body is being rewritten at a layer you don’t control, and only their config will show the transform that skipped re-framing.
  • If the malformed framing traces to a framework or runtime’s HTTP stack rather than your own code, treat it as a library bug: pin or upgrade the version, and disable any manual chunking you added on top of it, rather than trying to sanitize the output downstream.

Related Tools

Related Guides

Share this guide

[Ad] Guide Detail Inline
← Back to All Guides