ERR_HTTP2_STREAM_CANCEL
node
network_error
ai_generated
true
Error [ERR_HTTP2_STREAM_CANCEL]: The pending stream has been canceled (code: NGHTTP2_CANCEL)
ID: node/err-http2-stream-cancel
82%Fix Rate
80%Confidence
45Evidence
2021-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 20 | active | — | — | — |
Root Cause
HTTP/2 stream was cancelled by the remote peer or due to timeout. Common with gRPC clients, HTTP/2 proxies, or when the server resets the stream. Often seen behind load balancers with HTTP/2 keepalive mismatches.
genericWorkarounds
-
85% success Increase HTTP/2 stream timeout and keepalive settings on the client
const client = http2.connect(url, { settings: { maxConcurrentStreams: 100 }, peerMaxConcurrentStreams: 100 }); client.setTimeout(30000);Sources: https://nodejs.org/api/http2.html
-
88% success Configure load balancer to match HTTP/2 keepalive timeouts
Ensure the client's keepalive interval is shorter than the load balancer's idle timeout. For ALB: set idle_timeout to be longer than client keepalive.
Sources: https://nodejs.org/api/http2.html#http2session-and-sockets
Dead Ends
Common approaches that don't work:
-
Simply retrying the same request immediately
65% fail
If the server or load balancer is actively resetting HTTP/2 streams due to configuration limits, retrying hits the same limit. Need to address the root cause first.
-
Downgrading to HTTP/1.1 globally
70% fail
Loses multiplexing, header compression, and server push benefits. May not be possible if the server only supports HTTP/2 (e.g., gRPC requires HTTP/2).
Error Chain
Frequently confused with: