{{ message }}
Repository navigation
Conversation
duplexify() called the public Readable.from(iterable, opts) with the three-argument signature of the internal from(Readable, iterable, opts) helper, so it passed the Duplexify class as the iterable and threw ERR_INVALID_ARG_TYPE. Every Duplex.from() call that takes the iterable path failed: arrays, strings, Sets, async iterables and async generator functions. compose() calls Duplex.from() on a leading or trailing function stage, so it failed the same way. Call the internal helper instead, as Node.js does. No compatibility flag: these calls always threw, so code that worked before behaves the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jasnell
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Duplex.from()throwsERR_INVALID_ARG_TYPEfor every input that takes its iterable path: an array, a string, aSet, an async iterable, or an async generator function.stream.compose()callsDuplex.from()on a leading or trailing function stage, so it fails the same way:What was wrong.
duplexify()insrc/node/internal/streams_duplex.jscallsReadable.from(Duplexify, value, opts). That is the three-argument signature of the internalfrom(Readable, iterable, opts)helper instreams_readable.js, but it calls the publicReadable.from(iterable, opts)instead, which treats theDuplexifyclass as the iterable and throws. Node.js calls the internal helper at this point (lib/internal/streams/duplexify.js).What changed.
streams_duplex.jsimports the internalfromfromnode-internal:streams_readable(asreadableFrom, because the module already exports its ownfrom) and calls it in both places. With that,Duplex.from()over an iterable returns a readable-only objectMode Duplex, and over an async generator function it returns a Duplex that feeds writes into the function and reads what it yields, as in Node.js.Compatibility. No compatibility flag: these calls always threw before this change, so code that worked before behaves the same.
Tests. Two new cases in
src/workerd/api/node/tests/streams-test.js:duplexFromIterable:Duplex.from()over an array, a string (one chunk), aSetand an async generator object.duplexFromAsyncGeneratorFunction:Duplex.from()over an async generator function, andcompose()with a trailing function stage.Without the fix, both fail with the error above in all three variants of
streams-test; with it they pass. The same assertions pass on Node.js v26.10.0. Run locally on macOS (arm64):The other
node:streamtests also pass with the change://src/tests/node/stream/...,streams-nodejs-testandstreams-v24-nodejs-test(all variants),fs-readstream-test@andfs-writestream-test@.I prepared this PR with an AI coding agent (Claude Code). I am responsible for it and will answer review comments.
🤖 Generated with Claude Code