PANE

Bun HTTP servers emit 'clientError' after chunked framing

13 posts in the last 60 days, all from GitHub.

“What version of Bun is running? 1.4.4 canary.1+017b2439a What platform is your computer? Darwin 27.0.0 arm64 arm What steps can reproduce the bug? What is the expected behavior? Node v26.11.1. What do you see instead? Additional information On the wire Bun sends the status line…”
GitHub
“What version of Bun is running? 1.4.3+c6da4a4d3 (also reproduces on 1.4.4 canary.1+6c1eb067e) What platform is your operating system? Linux 6.18 x86 64 (Debian trixie container under WSL2) What steps can reproduce the bug? A node:http server that upgrades with ws 's…”
GitHub
“What version of Bun is running? 1.4.2 What platform is your computer? Microsoft Windows NT 10.0.26200.0 x64 What steps can reproduce the bug? PS bun install g trust @opencode/cli bun add v1.4.2 (744846f84) ⚙️ @opencode/cli [1/1] bun: command not found: node error: postinstall…”
GitHub

Several users are encountering errors with Bun's HTTP server implementation, specifically related to chunked encoding and upgrade requests. Issues include unexpected 'clientError' events, incorrect handling of pipelined requests, and problems with CONNECT requests involving authority forms. These issues often manifest as dropped connections or incomplete responses.

devtoolsbughttpbunserver
FIT
0%
SIGNAL
82%
SOURCES13
FRESHEST POST2D AGO
TRACKED SINCE22D AGO

SOURCES (13)

“What version of Bun is running? 1.4.4 canary.1+017b2439a What platform is your computer? Darwin 27.0.0 arm64 arm What steps can reproduce the bug? What is the expected behavior? Node v26.11.1. What do you see instead? Additional information On the wire Bun sends the status line…”

GITHUB2d ago

“What version of Bun is running? 1.4.3+c6da4a4d3 (also reproduces on 1.4.4 canary.1+6c1eb067e) What platform is your operating system? Linux 6.18 x86 64 (Debian trixie container under WSL2) What steps can reproduce the bug? A node:http server that upgrades with ws 's WebSocketServer({ noServer: true }) + handleUpgrade (Bun's built in ws replacement) and sends a burst of large binary frames: What is the expected behavior? Exactly 64 frames, in order, each 1 MiB, as with Node + the ws npm package.”

GITHUB8d ago

“What version of Bun is running? 1.4.2 What platform is your computer? Microsoft Windows NT 10.0.26200.0 x64 What steps can reproduce the bug? PS bun install g trust @opencode/cli bun add v1.4.2 (744846f84) ⚙️ @opencode/cli [1/1] bun: command not found: node error: postinstall script from "@opencode/cli" exited with 1 PS bun install g node bun add v1.4.2 (744846f84) ⚙️ node [1/1] bun: command not found: node error: preinstall script from "node" exited with 1 ANNOYINGLY, SOMETIMES< it randomly wor”

GITHUB23d ago

“What happens On Bun.serve , a CONNECT request with an authority form target ( CONNECT example.com:80 ) and a Content Length above 0 never gives its body to the handler. await req.text() stays pending and the client gets no response. The same request with an origin form target ( CONNECT /x ) works. Repro Bun 1.4.3 canary.1+367d939d9 (linux x64): Cause src/runtime/server/mod.rs:739 decides that the request has a body from the method and Content Length . Method::has request body() is true for CONNE”

GITHUB29d ago

“What happens A request arrives with its body in the same TCP segment as its headers. The 'request' listener reads the request and destroys the connection in the same tick. Node.js still delivers the body bytes that it already has. When the body is complete, Node.js emits 'data' and 'end' and does not abort the request. Bun drops the bytes and aborts the request. Repro Node v26.3.0: req data:10, req end, req close (complete=true) Bun 1.4.3 (canary 367d939d9): req aborted, req error:aborted, req c”

GITHUB29d ago

“What happens Two requests arrive pipelined on one connection. The 'request' listener destroys the second response while it is still queued behind the first one. The second request then never emits 'aborted' , 'error' or 'close' . A consumer that waits for the end of that request ( for await , stream.finished , a body parser) never settles. Repro Node v26.3.0: res2 close, req2 aborted, req2 error:ECONNRESET, req2 close Bun 1.4.3 (canary 367d939d9): res2 close Cause (from a read of the code) advan”

GITHUB29d ago

“What version of Bun is running? 1.4.3 canary.1+b52d51348 (also main at 26e7a4b369) What platform is your computer? Linux x64 (the code path is the same on every platform) What steps can reproduce the bug? A node:http server hands a CONNECT socket to the 'connect' listener. The listener pauses the socket, as socket.pipe(upstream) does when the upstream is slow. The client writes 256 MB. Run the script with node and with bun . What is the expected behavior? Node v26.3.0 stops reading the connectio”

GITHUB29d ago

“What happens An Upgrade request that arrives while an earlier response on the same connection is still pending goes to the 'request' event. The server does not call shouldUpgradeCallback , does not emit 'upgrade' , and sets req.upgrade to false . Node v26.3.0 calls shouldUpgradeCallback with req.upgrade === true and emits 'upgrade' for that request. A pipelined CONNECT request takes the same path. It goes to 'request' and not to 'connect' . Reproduction Node v26.3.0 prints: Bun 1.4.3 canary (367”

GITHUBSep 19

“What happens res.write(chunk, "") and res.end(chunk, "") on http.ServerResponse throw TypeError [ERR INVALID ARG TYPE]: Invalid encoding . Node writes the chunk as utf8, because Writable.prototype.write uses the default encoding for a falsy encoding argument. Reproduction Node v26.3.0 prints 200 ok . Bun 1.4.3 canary (b52d51348) prints 500 ERR INVALID ARG TYPE: Invalid encoding . Bun 1.3.1 prints the same, so this is not a regression from 23968. res.write("ok", "") followed by res.end() gives th”

GITHUBSep 18

“What version of Bun is running? 1.4.2+744846f84 (also main at 367d939d9a) What platform is your computer? Linux x64 (the code path is the same on every platform) What steps can reproduce the bug? A node:http server with insecureHTTPParser: true (or httpValidation: "insecure" ) receives an ordinary request whose Transfer Encoding does not end in chunked . Run the script with node and with bun . What is the expected behavior? Node v26.3.0 reads the body until the client ends the connection, and ra”

GITHUBSep 18

“What version of Bun is running? 1.4.3 canary.1+b52d51348 (also main at fd8422ce47) What platform is your computer? Linux x64 (the code path is the same on every platform) What steps can reproduce the bug? A node:http server accepts an Upgrade request that has Transfer Encoding: chunked and a malformed chunk size. Run the script with node and with bun . What is the expected behavior? Node v26.3.0 emits 'upgrade' and no 'clientError' . The socket stays open: What do you see instead? Bun emits 'upg”

GITHUBSep 18

“What happens A node:http server upgrades a request to a WebSocket from the request's body handler, for example wss.handleUpgrade() inside req.on("end") for an upgrade request that carries a body. After that, the next request on any other connection of the same server stops the parser after its first request. Requests pipelined behind it in the same read get no answer, and the connection stays open. | | Node v26.3.0 + ws 8.18.3 | Bun 1.4.2 | | | | | | control (no upgrade before) | ["/one","/two"]”

GITHUBSep 17

“What happens server.upgrade(res, { headers }) for a node:http response (the path that the ws package uses) converts options.headers after it checks that the response is still open. The conversion can run user code: a getter, a toString() , an iterator. If that code ends the response, upgrade() returns false , but it still writes the converted headers to the socket. The bytes land after the finished response. Found during the review of 43023. That PR does not change this path for a plain object,”

GITHUBSep 17

SOLUTION LANDSCAPE

Brought to you byTop Sectors

A Player feature.See how many ways this pain can be solved, who's already building, and where the gaps are.