René's URL Explorer Experiment


Title: `stream.pipeline()` can both throw synchronously and invoke the callback reporting success · Issue #65127 · nodejs/node · GitHub

Open Graph Title: `stream.pipeline()` can both throw synchronously and invoke the callback reporting success · Issue #65127 · nodejs/node

X Title: `stream.pipeline()` can both throw synchronously and invoke the callback reporting success · Issue #65127 · nodejs/node

Description: Version v24.11.1, and main (aed4eaf89dd) Platform Reproduced on Windows 11 x64; the code path is platform independent. Subsystem stream What steps will reproduce the bug? When pipeline() throws synchronously while wiring the streams toge...

Open Graph Description: Version v24.11.1, and main (aed4eaf89dd) Platform Reproduced on Windows 11 x64; the code path is platform independent. Subsystem stream What steps will reproduce the bug? When pipeline() throws syn...

X Description: Version v24.11.1, and main (aed4eaf89dd) Platform Reproduced on Windows 11 x64; the code path is platform independent. Subsystem stream What steps will reproduce the bug? When pipeline() throws syn...

Opengraph URL: https://github.com/nodejs/node/issues/65127

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`stream.pipeline()` can both throw synchronously and invoke the callback reporting success","articleBody":"### Version\n\nv24.11.1, and `main` (`aed4eaf89dd`)\n\n### Platform\n\nReproduced on Windows 11 x64; the code path is platform independent.\n\n### Subsystem\n\nstream\n\n### What steps will reproduce the bug?\n\nWhen `pipeline()` throws synchronously while wiring the streams together, it can *also* invoke the callback, and the callback reports success. The caller therefore receives the same operation reported twice, once as an exception and once as a successful completion.\n\n```js\nimport { pipeline, Readable, Transform, PassThrough } from 'node:stream';\n\nfunction run(label, streams) {\n  return new Promise((resolve) => {\n    let threw = null;\n    const calls = [];\n    try {\n      pipeline(...streams, (err) => calls.push(err ? err.code : 'NO ERROR'));\n    } catch (err) {\n      threw = err.code;\n    }\n    setTimeout(() => {\n      console.log(`${label}`);\n      console.log(`   threw            : ${threw}`);\n      console.log(`   callback invoked : ${calls.length} time(s) ${calls.length ? JSON.stringify(calls) : ''}`);\n      resolve();\n    }, 150);\n  });\n}\n\n// A node stream in the middle wires pipe(), which increments finishCount\n// before the later stage throws.\nawait run('A. readable -> transform -> bad fn', [\n  Readable.from(['a']),\n  new Transform({ transform(c, e, cb) { cb(null, c); } }),\n  () => 42,\n]);\n\n// Control: the throw happens before anything increments finishCount.\nawait run('B. readable -> bad fn -> passthrough  (control)', [\n  Readable.from(['a']),\n  () => 42,\n  new PassThrough(),\n]);\n```\n\n### How often does it reproduce? Is there a required condition?\n\nEvery time, for case A. The condition is that `finishCount` has already been incremented by an earlier stage before a later stage throws, which happens whenever a node stream is wired before the throwing stage.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nA single failure should be reported once. If `pipeline()` throws synchronously then the callback should not also run, and it certainly should not run with no error, since the pipeline did not succeed.\n\nCase B shows the intended behaviour: the callback is not invoked when `pipeline()` throws.\n\n### What do you see instead?\n\n```\nnode v24.11.1\n\nA. readable -> transform -> bad fn\n   threw            : ERR_INVALID_RETURN_VALUE\n   callback invoked : 1 time(s) [\"NO ERROR\"]\n\nB. readable -> bad fn -> passthrough  (control)\n   threw            : ERR_INVALID_RETURN_VALUE\n   callback invoked : 0 time(s)\n```\n\nIn case A the caller gets an `ERR_INVALID_RETURN_VALUE` exception and, shortly afterwards, a callback saying the pipeline finished with no error.\n\n### Additional information\n\nThe wiring loop in `pipelineImpl()` increments `finishCount` as it wires each stage, for example `finishCount += 2` before `pipe()` in the node stream branch. If a later stage throws, those already-wired stages remain live. When they subsequently close they call `finish()`, which decrements `finishCount`; on reaching zero `finishImpl()` runs with `final` true and schedules `process.nextTick(callback, error, value)`.\n\nBecause the streams were never destroyed by `pipeline()` on this path, `error` is still undefined at that point, so the callback reports success.\n\nIn case B the throw happens before any stage incremented `finishCount`, so nothing later reaches zero and the callback is correctly never scheduled. That difference is what makes the behaviour inconsistent rather than simply undesirable.\n\nThis was noticed while working on #65064, which touches the same synchronous-throw path but deliberately does not change this behaviour.\n","author":{"url":"https://github.com/shani-singh1","@type":"Person","name":"shani-singh1"},"datePublished":"2026-08-08T05:09:12Z","url":"https://github.com/nodejs/node/issues/65127"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6e52e565-ba29-aa09-03c0-82b1b9b82075
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCB12:ABE51:7EE39D:A5B28D:6AED35D1
html-safe-nonce05cf04fc8a473ab2e58bff8c5785b2f8c7290e0fa430ce01e4a711d99bd733e4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjEyOkFCRTUxOjdFRTM5RDpBNUIyOEQ6NkFFRDM1RDEiLCJ2aXNpdG9yX2lkIjoiNzkxMjAzNDg3NDM5Njg0OTYxNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac8639248b1e2df1f1efed980146a4ff9f33ff386ddda9bdaca280ea2d27dc733b
hovercard-subject-tagissue:5095981501
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/65127/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1c580d4a751705d52995c0f6819dba26ddba8f45c416e35b8d631a372d3c02dc/nodejs/node/issues/65127
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1c580d4a751705d52995c0f6819dba26ddba8f45c416e35b8d631a372d3c02dc/nodejs/node/issues/65127
og:image:altVersion v24.11.1, and main (aed4eaf89dd) Platform Reproduced on Windows 11 x64; the code path is platform independent. Subsystem stream What steps will reproduce the bug? When pipeline() throws syn...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameshani-singh1
hostnamegithub.com
expected-hostnamegithub.com
None26c92a9388ddfad3fa88d132b5d5f0b4747030233dcc4e5efb05f1cbae152184
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec629ad99c254d306375fc8354d04321c2c362236
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/65127#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F65127
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F65127
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/65127
Reloadhttps://github.com/nodejs/node/issues/65127
Reloadhttps://github.com/nodejs/node/issues/65127
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests665 (665)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65127
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65127
stream.pipeline() can both throw synchronously and invoke the callback reporting successhttps://github.com/nodejs/node/issues/65127#top
https://github.com/shani-singh1
shani-singh1https://github.com/shani-singh1
on Aug 8, 2026https://github.com/nodejs/node/issues/65127#issue-5095981501
#65064https://github.com/nodejs/node/pull/65064
pacocartoneshttps://github.com/pacocartones
on Aug 9, 2026https://github.com/nodejs/node/issues/65127#event-29188146610
stream: prevent pipeline() callback after sync throwhttps://github.com/pacocartones/node/commit/4c49ce4cbc30714d5c5693efc7fae01f6c696a13
4c49ce4https://github.com/pacocartones/node/commit/4c49ce4cbc30714d5c5693efc7fae01f6c696a13
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/65127
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65127
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.