-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Gateway crashes with ERR_INVALID_STATE (FileHandle closed during GC) on Node 26 when handling inbound image media #99263
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Priority
None yet
Summary
On Node.js 26, the Gateway process crashes with an uncaught
ERR_INVALID_STATEexception originating from aFileHandlethat is closed by the garbage collector instead of being closed explicitly. The handle points at an inbound image file under the media inbound directory. Node 26 promoted GC-closedFileHandles from a deprecation warning to a hard error, so a latent unclosed-handle leak in the inbound-media path now crashes the process.Environment
2026.6.11(latest stable)26.3.0linux arm64Error
code:ERR_INVALID_STATEname:ErrorImpact
Root cause
Node 26 (per
nodejs/node, the change making GC-closedFileHandles throwERR_INVALID_STATErather than emit a deprecation warning) surfaces a pre-existing leak: aFileHandleopened in the inbound-media write/read path is never explicitly.close()d (or wrapped so it closes on all paths), so it is finalized by GC.Expected
Inbound-media file handles are closed explicitly (e.g.
try/finallyaroundfs.open, or usefs.readFile/fs.writeFile/streampipelinewhich manage the descriptor), so noFileHandleis left for the GC to reap.Suggested fix
Audit the inbound-media path for
fsPromises.open(...)usages whose returnedFileHandleis not guaranteed to be closed on every code path, and either close infinallyor switch to a higher-level API that owns the descriptor lifecycle.Notes
2026.7.1-beta.1changelog and inbound-media code do not address this (nodeengines floor is still>=22.19.0; no FileHandle/GC fix listed).