Title: Errors in composed streams hang since Node 22.5 · Issue #60083 · nodejs/node · GitHub
Open Graph Title: Errors in composed streams hang since Node 22.5 · Issue #60083 · nodejs/node
X Title: Errors in composed streams hang since Node 22.5 · Issue #60083 · nodejs/node
Description: Version 22.20.0 Platform Darwin Patricks-Laptop.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64 Subsystem streams What steps will reproduce the bug? Assuming a fi...
Open Graph Description: Version 22.20.0 Platform Darwin Patricks-Laptop.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64 Subsystem streams What ste...
X Description: Version 22.20.0 Platform Darwin Patricks-Laptop.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64 Subsystem streams What ste...
Opengraph URL: https://github.com/nodejs/node/issues/60083
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Errors in composed streams hang since Node 22.5","articleBody":"### Version\n\n22.20.0\n\n### Platform\n\n```text\nDarwin Patricks-Laptop.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64\n```\n\n### Subsystem\n\nstreams\n\n### What steps will reproduce the bug?\n\nAssuming a `file.txt` on disk that contains random text (e.g. `hello`), the following script will appropriately hit the catch block in Node 22.4.1 but not in Node versions after (including current LTS 22.20.0). I believe it is related to this change: https://github.com/nodejs/node/pull/53462\n\n```js\nimport { createReadStream } from \"node:fs\";\n\nconst fileStream = createReadStream(\"./file.txt\", {\n encoding: \"utf8\",\n});\n\nconst composedStreamOne = async function* (objectStream) {\n for await (const obj of objectStream) {\n throw new Error(\"Intentional error in composedStreamOne\");\n }\n};\n\nconst composedStreamTwo = async function* (objectStream) {\n for await (const obj of objectStream) {\n yield obj + \"goodbye\";\n }\n};\n\nconst composed = fileStream\n .compose(composedStreamOne)\n .compose(composedStreamTwo);\n\ntry {\n for await (const text of composed) {\n console.log(\"String is:\", text);\n }\n} catch (err) {\n console.error(\"Caught error:\", err.message);\n}\n```\n\nIn Node 22.4.1 we get:\n\n```\nnode -v \u0026\u0026 node compose.mjs\nv22.4.1\nCaught error: Intentional error in composedStreamOne\n```\n\nIn Node 22.5.0+ we get:\n\n```\nnode -v \u0026\u0026 node compose.mjs\nv22.5.0\nWarning: Detected unsettled top-level await at file:///Users/patrickshipe/projects/compose-bug/compose.mjs:24\n for await (const text of composed) {\n```\n\n### How often does it reproduce? Is there a required condition?\n\nIt will reproduce 100% of the time when composing streams like this.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe expected behavior is that the composed stream will correctly bubble up an error in any of the constituent streams.\n\n### What do you see instead?\n\nThe script will never complete, or fail on unsettled top-level await if at the top level.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/patrickshipe","@type":"Person","name":"patrickshipe"},"datePublished":"2025-10-01T12:37:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/60083/node/issues/60083"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ec22b328-018b-3858-8e08-0d8d10475d8d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B0B4:2EE522:C75B65:107A61A:6A4C467D |
| html-safe-nonce | 7d8c653b649f31fd15d27bd7cebee9b7f62fccaee7bc854a630b634710754666 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEI0OjJFRTUyMjpDNzVCNjU6MTA3QTYxQTo2QTRDNDY3RCIsInZpc2l0b3JfaWQiOiIzNzk4OTIyOTU3NjI0NzIzMDY5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a86f6de48f7aeea835330ef79ea2bc958e9a1ea671e5737ecaa8308508662c74 |
| hovercard-subject-tag | issue:3473388325 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/60083/issue_layout |
| twitter:image | https://opengraph.githubassets.com/77cd146aa1643d92a42ee87ea334411240c4fb38cec3d86205c904b953b0dc8b/nodejs/node/issues/60083 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/77cd146aa1643d92a42ee87ea334411240c4fb38cec3d86205c904b953b0dc8b/nodejs/node/issues/60083 |
| og:image:alt | Version 22.20.0 Platform Darwin Patricks-Laptop.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64 Subsystem streams What ste... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | patrickshipe |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3996b3b83990e134be6c099ab9a7f48f140ae80f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width