ERR_HTTP2_PROTOCOL_ERROR Explained for Site Owners: What the Browser Saw and How to Find the Cause
ERR_HTTP2_PROTOCOL_ERROR means an HTTP/2 stream was reset or a response broke the rules. The usual causes (aborted responses, bad headers) and how to debug.
ERR_HTTP2_PROTOCOL_ERROR is Chrome's catch-all for an HTTP/2 request that ended abnormally: the server or a proxy reset the stream with an error code, closed the connection with an error, or sent a response that HTTP/2 doesn't allow. Despite the name, it is rarely a bug in the protocol layer. On sites behind nginx or a CDN it usually means a response was aborted mid-way (the upstream died, timed out, or nginx couldn't buffer it to disk), or the app sent headers that HTTP/2 forbids.
Checked against RFC 9113, Chromium's net stack source, nginx's source and docs, and the nghttp2 and curl sources in November 2026.
What visitors and developers see:
Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR
That's the DevTools console form; a full page shows Chrome's error page with the same code. Edge, Brave and other Chromium-based browsers use it too.
What happened at the protocol level
HTTP/2 runs many requests ("streams") over one TCP connection. There are two ways to abort something early, both defined in RFC 9113:
- RST_STREAM cancels one stream "or [indicates] that an error condition has occurred". The rest of the connection keeps working.
- GOAWAY shuts down the whole connection, either gracefully or "to signal serious error conditions".
Both frames carry an error code. The ones you'll meet:
| Code | Name | Typical meaning |
|---|---|---|
| 0x0 | NO_ERROR | Graceful, not an error |
| 0x1 | PROTOCOL_ERROR | Something broke the rules; "use when a more specific error code is not available" |
| 0x2 | INTERNAL_ERROR | "The endpoint encountered an unexpected internal error" |
| 0x7 | REFUSED_STREAM | Not processed, safe to retry |
| 0xb | ENHANCE_YOUR_CALM | Peer is generating excessive load |
| 0xd | HTTP_1_1_REQUIRED | Retry this over HTTP/1.1 |
Here is the important part. In Chromium's source (net/spdy/spdy_session.cc), a received RST_STREAM is handled like this: NO_ERROR, REFUSED_STREAM and HTTP_1_1_REQUIRED get special treatment, and every other code becomes ERR_HTTP2_PROTOCOL_ERROR. A comment there says it plainly: "For now, it doesn't matter much - it is a protocol error." A GOAWAY with any code other than NO_ERROR or HTTP_1_1_REQUIRED maps to the same error.
So when nginx resets a stream with INTERNAL_ERROR because your backend crashed, Chrome reports a "protocol error". The name tells you HTTP/2 was involved, not what went wrong.
Chrome also raises the error itself when it rejects a response: no :status pseudo-header, a transfer-encoding header, header names with uppercase letters, or control characters in header values.
Cause 1: the response was aborted mid-way
On a site behind nginx, check this first. The browser receives headers, starts receiving the body, then the stream is reset.
nginx's HTTP/2 code (ngx_http_v2_close_stream in src/http/v2/ngx_http_v2.c) closes a stream whose response wasn't finished by sending RST_STREAM with INTERNAL_ERROR, or PROTOCOL_ERROR if the client connection timed out. Anything that makes nginx give up on a response halfway produces that reset:
- The upstream closed the connection early. The app crashed, was OOM-killed, or was restarted during a deploy. nginx's error log shows
upstream prematurely closed connection while reading upstream. - The upstream stalled.
proxy_read_timeout(default 60s) applies "between two successive read operations". A backend that pauses longer mid-response gets cut off. - nginx couldn't write its buffer file. See cause 2.
Over HTTP/1.1, the same fault doesn't look like a protocol error. Chrome reports a truncated body as ERR_CONTENT_LENGTH_MISMATCH or ERR_INCOMPLETE_CHUNKED_ENCODING, depending on how the response was framed. That's why "turn off HTTP/2" sometimes seems to help: the error changes name, but the response is still incomplete.
Cause 2: nginx proxy buffering hit a full or unwritable disk
With proxy_buffering on (the default), nginx reads the upstream response into memory buffers. Per the proxy module docs, if the response doesn't fit, "a part of it can be saved to a temporary file on the disk", in the directory set by proxy_temp_path, up to proxy_max_temp_file_size (default 1024m).
If that disk is full, or the nginx worker user can't write to the temp directory (for example after changing the user directive), nginx fails partway through large responses. Small responses fit in memory and still work, so the homepage loads while a large JSON export or JavaScript bundle fails.
Check the error log for No space left on device or Permission denied on a path under the proxy temp directory, and check the disk:
sudo grep -E 'proxy_temp|No space left|Permission denied' /var/log/nginx/error.log | tail -20
df -h
(How to check disk space and memory on Linux has more.)
Fixes, least invasive first:
Free disk space, or fix ownership of the temp directory so the worker user can write to it.
For a specific location that serves large responses, stop spilling to disk:
location /exports/ { proxy_pass http://app; proxy_max_temp_file_size 0; # "The zero value disables buffering of responses to temporary files" }For streaming endpoints (server-sent events, long downloads),
proxy_buffering off;passes data through as it arrives. This holds an upstream connection open for the whole transfer, so use it per location rather than globally.
Cause 3: headers HTTP/2 does not allow
RFC 9113 section 8.2.2 forbids connection-specific header fields: Connection, Proxy-Connection, Keep-Alive, Transfer-Encoding and Upgrade. The only exception is TE: trailers on requests. A message containing them "MUST be treated as malformed", and malformed responses are a stream error of type PROTOCOL_ERROR.
Section 8.2.1 adds that field names must not contain uppercase letters, and values must not contain NUL, CR or LF or start or end with whitespace.
Who enforces this varies. Chromium rejects transfer-encoding, uppercase names and control characters in values. nghttp2 (used by curl and the nghttp tool) rejects all five connection-specific headers.
nginx drops Connection, Keep-Alive and Transfer-Encoding from upstream responses when it proxies (ngx_http_upstream.c ignores them), so a plain nginx-in-front setup is usually safe. The risk is an app that speaks HTTP/2 to browsers directly, or a proxy, edge function or middleware that copies upstream headers into an HTTP/2 response unfiltered. Uppercase names and stray newlines come from hand-built headers, such as a value read from an environment variable with a trailing newline.
Cause 4: Content-Length doesn't match the body
RFC 9113 section 8.1.1: a response is malformed "if the value of a content-length header field does not equal the sum of the DATA frame payload lengths". Typical culprits are middleware that changes the body after Content-Length was set: compression applied after the length was calculated, or HTML rewriting that injects a script tag.
nghttp2-based clients check this strictly. nginx catches the "too many bytes" direction from upstreams and logs upstream sent more data than specified in "Content-Length" header. If you set Content-Length by hand anywhere, remove it and let the server compute it, or make sure compression runs before the length is set.
How to debug it
1. Reproduce with curl, HTTP/2 vs HTTP/1.1
curl -sv --http2 -o /dev/null https://example.com/failing/path
curl -sv --http1.1 -o /dev/null https://example.com/failing/path
A reset on the HTTP/2 run ends with exit code 92 and a message like:
curl: (92) HTTP/2 stream 1 reset by server (error 0x2 INTERNAL_ERROR)
(Older curl versions word it as "stream 1 was not closed cleanly".) Then read the HTTP/1.1 run:
- HTTP/1.1 completes, and its headers include
Connection,Transfer-Encodingor uppercase names: a header problem in the HTTP/2 path (cause 3). - HTTP/1.1 is also cut short (
curl: (18)"transfer closed with ... bytes remaining"): the response is being aborted upstream (causes 1 and 2).
2. Watch the frames with nghttp
nghttp -nv https://example.com/failing/path
-v prints every frame, and RST_STREAM and GOAWAY frames include the error code, such as error_code=INTERNAL_ERROR(0x02). -n discards the body.
3. Capture what Chrome saw
Open chrome://net-export, click Start Logging To Disk, reproduce the error in another tab, then Stop Logging. Load the file into Chromium's NetLog viewer and search for these events:
HTTP2_SESSION_RECV_RST_STREAMandHTTP2_SESSION_RECV_GOAWAYshow what the server sent, with the error code.HTTP2_SESSION_RECV_INVALID_HEADERshows a header Chrome rejected and why ("Upper case characters in header name.").
Net logs can contain cookies and URLs, so don't post them publicly.
4. Find the matching server log line
Read nginx's error log around the time of the failure (upstream prematurely closed connection, timeouts, temp-file errors), then the app's own logs for a crash at the same moment. (502 Bad Gateway covers the same upstream failures when they happen before headers are sent.)
5. Test each hop
With a CDN in front, test the origin (curl --resolve example.com:443:ORIGIN_IP), then the app behind nginx (curl -v http://127.0.0.1:3000/failing/path on the server). The first hop where the response breaks is the one to fix. Reverse Proxies Explained maps out the layers, and Nginx Reverse Proxy Configuration has a working baseline config to compare against.
Quick reference
| Symptom | Likely cause | Look at |
|---|---|---|
| Large responses fail, small ones work | Proxy temp file can't be written | df -h, nginx error log, temp dir ownership |
| Fails during deploys or under load | Upstream crashing or restarting | App logs, OOM kills, upstream prematurely closed |
| Fails after a pause in a slow response | proxy_read_timeout |
Backend timing, timeout settings |
| Fails every time on one route, HTTP/1.1 fine | Forbidden or malformed header | Response headers over --http1.1 |
| Fails after enabling compression or HTML rewriting | Content-Length mismatch | Middleware order |
EasySpawn handles the routing and HTTPS in front of your app, so you aren't the one tuning a proxy's buffers and temp directories, and Claude Code runs on the same server as the app, where it can read the app's logs when a response gets cut off. It won't stop an app from crashing or sending a bad header. Join the waitlist.
Related: HTTP/1.1 vs HTTP/2 vs HTTP/3: What Changed and Whether You Should Care · Nginx Reverse Proxy Configuration: A Production-Ready Example · Reverse Proxies Explained: Nginx, Caddy, and Traefik in Front of Your App · 502 Bad Gateway: What It Means and How to Fix It
Keep reading
systemd-oomd Explained: The Userspace OOM Killer, How It Decides, and How to Tame It
systemd-oomd explained: how it uses PSI and swap use to kill cgroups before the kernel OOM killer, its defaults, how to spot kills, and how to exempt services.
Linux Pressure Stall Information (PSI): Measuring Resource Contention
CPU percentage and free memory don't tell you whether your workload is actually being slowed down. Pressure stall information does: the share of time tasks were stalled waiting for CPU, memory or I/O. Reading /proc/pressure, some vs full, per-cgroup pressure, triggers, and using PSI for alerts and OOM handling.