Lighthouse audit errors-in-console · Best Practices

"Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR": what it means and how to fix it

Quick answer: "Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR" means Chrome aborted an HTTP/2 response because the server or a proxy reset the stream or sent something HTTP/2 forbids. The common causes are a response cut off mid-body, a connection-specific header such as Connection or Transfer-Encoding, oversized headers, or a wrong Content-Length. Reproduce it with curl --http2 -v, then fix the server or proxy.
View raw .md for LLMs / your notes

This console message means Chrome gave up on an HTTP/2 response partway through. Either the server, or a proxy or CDN between you and the server, reset the stream, closed it before the body finished, or sent something the HTTP/2 rules forbid. Chrome drops the whole response and logs the error. The file never loads: a script does not run, a stylesheet does not apply, an image stays blank, or an API call fails. Lighthouse surfaces the message through the audit "Browser errors were logged to the console" (errors-in-console), and one row fails it. This page covers what the error means, why it often shows with a 200 status, how to find the hop that breaks it, and the fixes for each cause.

TL;DR

What does "net::ERR_HTTP2_PROTOCOL_ERROR" mean?

HTTP/2 sends many requests over one connection, each as its own stream. Either side can end a stream early with an RST_STREAM frame and an error code, and the protocol has strict rules about which headers and frames are allowed. Chrome reports ERR_HTTP2_PROTOCOL_ERROR when a stream for one of your resources ends in a way it cannot accept:

What happenedWhat it usually means
The server or proxy reset the stream (RST_STREAM with PROTOCOL_ERROR or INTERNAL_ERROR)The server hit an error while sending the response, or a proxy gave up on its upstream
The stream closed before the body finishedAn upstream timeout, a crashed worker, or a proxy that could not buffer the response
The response carried a header HTTP/2 forbidsA connection-specific header such as Connection, Keep-Alive, Transfer-Encoding or Upgrade, or an invalid header value
The body length did not match Content-LengthMiddleware changed the body (compression, injection) and left the old length

It is not a bug in your JavaScript, and it is not a DNS or certificate problem. The connection was set up fine; one response on it went wrong.

Why does ERR_HTTP2_PROTOCOL_ERROR show with status 200?

In the DevTools Network panel the request often shows 200 with the failure next to it. The headers, including the status line, arrived intact. The stream broke later, while the body was downloading. That narrows the cause to the response body:

A failure with no status at all points earlier: forbidden headers, oversized headers, or a reset before the response began.

How do I find the cause?

  1. Get the exact URL. In the Lighthouse report, expand "Browser errors were logged to the console". In DevTools, open the Network panel, reload, and look for the red row. Note the type (script, stylesheet, fetch) and whether it shows 200.
  2. Reproduce it outside the browser:

   curl --http2 -sv -o /dev/null https://example.com/path/to/file.js
   

At the end of the output, look for HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1) or INTERNAL_ERROR (err 2). A transfer that ends short of the size curl expected means the body was cut off.

  1. Compare with HTTP/1.1:

   curl --http1.1 -sv -o /dev/null https://example.com/path/to/file.js
   

If HTTP/1.1 succeeds and HTTP/2 fails, the problem is in the HTTP/2 layer of a server, CDN or proxy. If both fail, the response itself is broken.

  1. Bypass hops one at a time. Request the origin directly (or with the CDN switched to development or bypass mode). The first hop where the error appears is the one to fix.
  2. Read the error logs at that timestamp on the CDN, load balancer, web server and app. Look for upstream timeouts, client intended to send too large header, buffer or temp-file write errors, and worker crashes.
  3. For intermittent errors, record a Chrome net log. Open chrome://net-export, record while reproducing, and load the file in the NetLog viewer. The HTTP/2 session events show which stream was reset and with which error code.

How do I fix ERR_HTTP2_PROTOCOL_ERROR?

1. Remove connection-specific headers

HTTP/2 forbids Connection, Keep-Alive, Proxy-Connection, Transfer-Encoding and Upgrade in responses. A server or app that adds them by hand (common in custom middleware and older PHP code) can trigger the error. Remove them from the app; the server handles the connection itself.

2. Keep headers and cookies small

Very large response headers, often from piled-up Set-Cookie headers or a huge Content-Security-Policy, can exceed the limits of the server, proxy or browser. Trim cookies, combine policies, and raise the header size limit on the proxy only if the size is legitimate.

3. Make Content-Length match the body, or drop it

If a plugin, compression layer or HTML injector changes the body after Content-Length is set, the length is wrong. Let the server compute the length, or remove the header and let HTTP/2 framing end the body.

4. Stop the proxy from cutting off responses

5. Update or reconfigure the server or CDN

Old HTTP/2 implementations have had bugs that surface as this error. Update nginx, Apache, your load balancer or the CDN configuration. As a temporary measure to confirm the diagnosis, turning HTTP/2 off at one hop and seeing the error vanish proves where it lives. Do not leave HTTP/2 off as the fix.

Can the visitor's computer cause it?

Yes, for that one visitor. Antivirus suites that inspect HTTPS traffic, some corporate proxies and VPNs, and rarely a browser extension sit in the middle and can break HTTP/2 streams. The sign is an error only one person sees. Ask them to try another network, another browser profile, or with HTTPS scanning turned off. If the row shows in PageSpeed Insights, Lighthouse CI or the audit at lighthouse-md.com, which run in a clean Chrome on Google's network, the cause is on your side.

How do I fix it on WordPress, Shopify, or Next.js?

How do I verify the fix?

  1. Run the curl --http2 -v command again. It should complete with no "not closed cleanly" line.
  2. Re-run Lighthouse. The row should be gone from "Browser errors were logged to the console". If it was the only error, the audit passes.
  3. For an intermittent error, watch the server and proxy logs for a day. One clean run proves little when the cause is a timeout under load.

What mistakes should I avoid?


Audit your URL at https://lighthouse-md.com.

Audit your page now

Paste your URL, get scores plus a CLAUDE.md plan for Claude Code.

Run audit →
Add us as a preferred source on Google

One click, and Google shows more of lighthouse-md.com in your search results.