Title: Errors are not forwarded when using stream.duplexPair() · Issue #61015 · nodejs/node · GitHub
Open Graph Title: Errors are not forwarded when using stream.duplexPair() · Issue #61015 · nodejs/node
X Title: Errors are not forwarded when using stream.duplexPair() · Issue #61015 · nodejs/node
Description: Version v25.2.1 Platform Linux 6.17.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 24 Nov 2025 15:21:09 +0000 x86_64 GNU/Linux Subsystem stream What steps will reproduce the bug? Create a duplex pair and destroy one side with an error. import str...
Open Graph Description: Version v25.2.1 Platform Linux 6.17.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 24 Nov 2025 15:21:09 +0000 x86_64 GNU/Linux Subsystem stream What steps will reproduce the bug? Create a duplex pair and de...
X Description: Version v25.2.1 Platform Linux 6.17.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 24 Nov 2025 15:21:09 +0000 x86_64 GNU/Linux Subsystem stream What steps will reproduce the bug? Create a duplex pair and de...
Opengraph URL: https://github.com/nodejs/node/issues/61015
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Errors are not forwarded when using stream.duplexPair()","articleBody":"### Version\n\nv25.2.1\n\n### Platform\n\n```text\nLinux 6.17.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 24 Nov 2025 15:21:09 +0000 x86_64 GNU/Linux\n```\n\n### Subsystem\n\nstream\n\n### What steps will reproduce the bug?\n\nCreate a duplex pair and destroy one side with an error.\n\n```javascript\nimport stream from \"node:stream\";\n\nconst [ sideA, sideB ] = stream.duplexPair();\n\nsideA.on(\"error\", (err) =\u003e {\n console.error(\"sideA error:\", err);\n});\n\nsideA.on(\"close\", () =\u003e {\n console.log(\"sideA closed\");\n});\n\nsideA.resume();\n\nsideB.on(\"error\", (err) =\u003e {\n console.error(\"sideB error:\", err);\n});\n\nsideB.on(\"close\", () =\u003e {\n console.log(\"sideB closed\");\n});\n\nsideB.destroy(Error(\"Simulated error on sideB\"));\n\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways\n\n### What is the expected behavior? Why is that the expected behavior?\n\nI would expect on of the following outputs.\n\nIdeally:\n\n```\nsideB error: Error: Simulated error on sideB\n at file:///duplex-pair-test.ts:23:15\n at ModuleJob.run (node:internal/modules/esm/module_job:413:25)\n at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:654:26)\n at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)\nsideB closed\nsideA error: Error: Simulated error on sideB\n at file:///duplex-pair-test.ts:23:15\n at ModuleJob.run (node:internal/modules/esm/module_job:413:25)\n at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:654:26)\n at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)\nsideA closed\n```\n\nor\n\n```\nsideB error: Error: Simulated error on sideB\n at file:///duplex-pair-test.ts:23:15\n at ModuleJob.run (node:internal/modules/esm/module_job:413:25)\n at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:654:26)\n at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)\nsideB closed\nsideA closed\n```\n\nThe latter would be what I see, if I created a TCP socket pair manually.\n\n### What do you see instead?\n\n```\nsideB error: Error: Simulated error on sideB\n at file:///home/simon/projects/krevp/lib/new/duplex-pair-test.ts:23:15\n at ModuleJob.run (node:internal/modules/esm/module_job:413:25)\n at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:654:26)\n at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)\nsideB closed\n```\n\nsideA doesn't notice that sideB has errored or closed.\n\n### Additional information\n\nIn the provided minimal example the process also closes, as there are no pending tasks. If I keep it open via e.g. setInterval, still, no events on sideA.","author":{"url":"https://github.com/skadisch","@type":"Person","name":"skadisch"},"datePublished":"2025-12-10T11:31:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/61015/node/issues/61015"}
| 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:53946bae-e27a-9d4b-6d06-8bf0326260db |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E3BA:236C7E:4DB74:6644F:6A4C6606 |
| html-safe-nonce | 0efe7f398a37e18cebbb6a77717b0818a1bd8f0b740ebf6e7828fe4b47a61ca9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0JBOjIzNkM3RTo0REI3NDo2NjQ0Rjo2QTRDNjYwNiIsInZpc2l0b3JfaWQiOiI2NTE4Njg2Mjg0NTc0OTA5OTU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2dbfd2b1d30a03e9c54229d051ccfec706dcb7917e677fe4ec012d513a33bbca |
| hovercard-subject-tag | issue:3714802923 |
| 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/61015/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eb137e23d1f4cffc272fd1fb213518a2e5dc4ba67573372faa1ea1b810dd850c/nodejs/node/issues/61015 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eb137e23d1f4cffc272fd1fb213518a2e5dc4ba67573372faa1ea1b810dd850c/nodejs/node/issues/61015 |
| og:image:alt | Version v25.2.1 Platform Linux 6.17.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 24 Nov 2025 15:21:09 +0000 x86_64 GNU/Linux Subsystem stream What steps will reproduce the bug? Create a duplex pair and de... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | skadisch |
| 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 | 14099438da5379150f15a2892474c7c7e6c0e55e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width