Fix crash when calling text() on consumed ReadableStream body#28740
Fix crash when calling text() on consumed ReadableStream body#28740
Conversation
ByteBlobLoader.toBufferedValue returned .zero without throwing a JS exception when the blob store was already detached (e.g. after calling Response.bytes() while holding a reference to Response.body). This violated the host function contract that .zero means an exception was set, triggering an assertion failure. Throw a proper JS error instead.
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, push a new commit or reopen this pull request to trigger a review.
|
Updated 1:27 AM PT - Apr 1st, 2026
❌ @autofix-ci[bot], your commit 3eca4ae has 4 failures in
🧪 To try this PR locally: bunx bun-pr 28740That installs a local version of the PR into your bun-28740 --bun |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughModifies Changes
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
What:
ByteBlobLoader.toBufferedValuereturned.zero(null JSValue) without throwing a JS exception when the blob store had already been detached, violating the host function contract and triggering an assertion failure.How to reproduce:
When
Response.bytes()is called, it detaches the underlying blob store from theByteBlobLoader. A subsequentbody.text()call on the already-obtainedReadableStreamreference reachestoBufferedValuewheretoAnyBlob()returnsnull. The function then returned.zero— but thetoJSHostCallwrapper asserts that.zeromeans a JS exception was set, which it wasn't.Fix: Throw a proper JS error (
"Body already consumed") instead of returning.zero, matching the pattern used byByteStream.toBufferedValuefor similar error cases.Crash fingerprint:
8528c32f3d75dc9f