You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Uncatchable AssertionError: assert(!this.paused) on socket end #5360
If the consumer doesn't read the body immediately, the HTTP/1 parser pauses under
backpressure. When the socket ends (FIN), onHttpSocketEnd calls parser.finish(),
which asserts !this.paused. Since the parser is paused, this throws an uncatchable AssertionError from the socket 'end' handler and crashes the process.
AssertionError [ERR_ASSERTION]: assert(!this.paused)
at Parser.finish (.../undici/lib/dispatcher/client-h1.js:374:5)
at Socket.onHttpSocketEnd (.../undici/lib/dispatcher/client-h1.js:951:30)
onHttpSocketEnd doesn't check parser.paused before calling finish().
Reproduction (minimised with Claude Code)
import{createServer}from"node:net";import{fetch}from"undici";constBODY=Buffer.alloc(64*1024,0x61);constserver=createServer((sock)=>{sock.once("data",()=>{sock.write("HTTP/1.1 200 OK\r\n"+`Content-Length: ${BODY.length}\r\n`+"Connection: close\r\n\r\n",);sock.write(BODY);sock.end();// FIN});});server.listen(0,"127.0.0.1",async()=>{const{ port }=server.address();constres=awaitfetch(`http://127.0.0.1:${port}/`);voidres;// never read the body -> parser pauses -> crash on FINawaitnewPromise((r)=>setTimeout(r,1000));console.log("no crash");// never reached});
The 64 KiB body is the body highWaterMark — the smallest size that pauses while still
arriving in one socket read, which makes this deterministic. It's not a fixed value:
the real trigger is "paused with the read buffer drained when FIN arrives," so the
size is network-dependent (intermittent across sizes over a real connection).
Expected vs actual
Expected: clean end, or a catchable error. A peer closing a non-keep-alive
response under backpressure shouldn't crash the process.
nice catch. the fix should be straightforward — in onHttpSocketEnd (client-h1.js:951), check parser.paused before calling parser.finish(). if paused, resume the parser first so it drains the internal buffer, then finish.
alternatively, wrapping the parser.finish() call in a try/catch or guard would prevent the uncatchable throw from the socket event handler, but properly resuming before finishing seems like the cleaner fix.
Activity
fix(h1): complete paused parser on socket end instead of crashing
AliMahmoudDev commentedon Jun 7, 2026
nice catch. the fix should be straightforward — in
onHttpSocketEnd(client-h1.js:951), checkparser.pausedbefore callingparser.finish(). if paused, resume the parser first so it drains the internal buffer, then finish.alternatively, wrapping the
parser.finish()call in a try/catch or guard would prevent the uncatchable throw from the socket event handler, but properly resuming before finishing seems like the cleaner fix.fix: handle paused parser on socket end (issue #5360) (#5389)
Azlond commentedon Jul 1, 2026
We started seeing this error in Node 24.17, and it still occurs in 24.18, which both use undici@7. Any chance the fix could get backported to the v7 release?
https://github.com/nodejs/undici/blame/v7.x/lib/dispatcher/client-h1.js#L367
Log pending fetch requests on uncaught exception
fix(api): route outbound fetch through fixed undici 8.x
fix(main): route Codex + PostHog through electron net.fetch
fix(deps): upgrade undici to ^8.10.0
fix(deps): upgrade undici to ^8.10.0
fix(deps): upgrade undici to ^8.10.0
The wire outlives the socket: pin the fetch, discharge every body, re…
fix(install): build node-pty against the managed Node's own headers
fix(tunnel): buffer the cloudflared download and drop unread bodies
2 remaining items
fix: fetch fix nodejs/undici#5360
fix(api): talk to the desktop app over node:http so an undici parser …
ci: pnpm via corepack install com retry e versão só no packageManager
fix(server): bump undici to 8.x to stop an uncatchable parser crash (#…
fix(server): bump undici to 8.x to stop an uncatchable parser crash (#…
defuddle: a compressed page can no longer crash or exhaust the service
ci(J4): download with Node's own HTTP client; plate-solver-smoke runs…
ci(J4): install-astap on the shared module; the refresh reads and wri…
docs(notes): open X1b with the owner's F2 ruling, retract the run-as-…
fix(net-fetch): downloads go through undici 8 with their own Agent, s…
test(pod): ask for a published release's head, not a body left unread
E2E: Download content-blocker filter lists through Playwright instead…
studio: fetch the block lists over chromium so undici can't throw unc…
build: download filter lists with node:https instead of fetch
Fix the protection-off race and the undici crash in list downloads (#16)