Repository navigation
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-infoClawSweeper needs more reporter information before it can verify this issue.ClawSweeper needs more reporter information before it can verify 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: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.Decent issue quality, but reproduction details are still incomplete.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Bug Description
OpenClaw crashes with ERR_INVALID_STATE when an agent processes a message via the Feishu channel. The error occurs because a FileHandle (from fs.promises.open) is garbage collected without being explicitly closed.
Environment
- OpenClaw: 2026.6.10 (aa69b12)
- Node.js: v25.9.0 (win32 x64)
- OS: Windows 11
- Channel: Feishu (WebSocket mode)
Steps to Reproduce
- Configure a workspace that contains a file (e.g.,
.mp4video) - Send a message to an agent via Feishu channel that triggers workspace file access
- OpenClaw crashes with:
Reason: A FileHandle object was closed during garbage collection. This used to be allowed with a deprecation warning but is now considered an error. Please close FileHandle objects explicitly. File descriptor: 4 (\\?\C:\Users\Administrator\.openclaw\workspace\starcraft-battle-v2.mp4)
Error Details
- Error code:
ERR_INVALID_STATE - The crash happens during agent message processing, after
message.dispatch.startedand duringembedded_run - Process restarts automatically via Scheduled Task, but the crash repeats on every message to the affected agent
- The affected file is a ~7MB
.mp4file in the workspace directory
Root Cause
Likely in openclaw's workspace/file tool code where fs.promises.open() or similar APIs create FileHandle objects but the corresponding .close() is not called before the handle goes out of scope. Node.js v25 enforces this as a fatal error (previously a deprecation warning in Node.js 18-24).
Workaround
- Move large files out of the workspace directory
- Downgrade to Node.js 20 LTS
Additional Info
Stability bundle with full event snapshot available at ~/.openclaw/logs/stability/
Reacted by clawsweeper
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.ClawSweeper needs more reporter information before it can verify 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: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.Decent issue quality, but reproduction details are still incomplete.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Priority
None yet
Activity
clawsweeper commentedon Jun 24, 2026
ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 28, 2026, 2:37 AM ET / 06:37 UTC.
Summary
Codex review failed: timeout (exit 0).
Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.
Ways to help us reproduce this
Next step
Review did not complete, so no work-lane recommendation was made.
Review details
Best possible solution:
Retry the Codex review after fixing the execution failure.
Do we have a high-confidence way to reproduce the issue?
Unclear. The review failed before ClawSweeper could establish a reproduction path.
Is this the best way to solve the issue?
Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.
AGENTS.md: unclear because the file could not be read completely.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against 119dc4bd821e.
Label changes
Label changes:
issue-rating: 🦪 silver shellfish: Current issue advisory state selects this label.P1: Current review triage priority is none.clawsweeper:no-new-fix-pr: Current issue advisory state no longer selects this label.clawsweeper:needs-maintainer-review: Current issue advisory state no longer selects this label.impact:crash-loop: Current review selected no impact labels.issue-rating: 🦐 gold shrimp: Current issue advisory state no longer selects this label.Evidence reviewed
What I checked:
Likely related people:
How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.kzclaw commentedon Jun 25, 2026
Additional data point for this issue — same ERR_INVALID_STATE error, different trigger file and platform.
Environment
Error details
Occurrences (last 48h)
Additional context
Stability bundles in ~/.openclaw/logs/stability/:
xialonglee commentedon Jun 26, 2026
I did a thorough FileHandle lifecycle audit across both
openclaw/fs-safeandopenclaw/openclawto look for potentialERR_INVALID_STATEleaks under Node.js v25+.What I checked:
@openclaw/fs-safe(v0.3.0) — Reviewedsidecar-lock.js(releaseHeldLock,releaseAllLocksSync),root-impl.js(OpenResultdispose symbols,openVerifiedLocalFile,openWritableFileInRoot,copyFileFallback,writeFileFallback), andread-opened-file.js. All regular FileHandle paths have explicitfinally { handle.close() }guards. TheOpenResultusesSymbol.asyncDispose(no syncSymbol.dispose), but that's defensive since no current caller usesusingsyntax.openclaw/openclaw— Audited every directfs.open()/fs.promises.open()/openLocalFileSafely()call site (~37+ acrosssrc/andextensions/), plus everycreateReadStream/createWriteStream/handle.createReadStreamcall site (~20+). All of them have correcttry { ... } finally { handle.close() }or equivalent stream cleanup (rl.close() + stream.destroy()).Result: No smoking gun. Every FileHandle creation point I could find has proper explicit close in finally guards. The two distinct crash signatures from the reports (Feishu workspace
.mp4path vs. active-memorysession.jsonl.lockpath) suggest the FileHandle owner is somewhere in the fs-safe lock or media-read stacks, but I couldn't isolate a specific leaking path in the current source.Possible next steps:
uncaughtExceptiondowngrade from crash to warn forERR_INVALID_STATEuntil the exact leak is pinned down, since this is a Node.js v25 enforcement change from v20-24's deprecation warning)~/.openclaw/logs/stability/bundles that would have the full async stack--trace-gcor Node.js inspector heap snapshotsI'll leave this for maintainer follow-up — the audit confirms the fix isn't a trivial missing
.close()in a single file.openclaw-barnacle commentedon Jul 12, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
openclaw-barnacle commentedon Jul 20, 2026
Closing due to inactivity.
If this is still an issue, please retry on the latest OpenClaw release and share updated details.
If you are absolutely sure it still happens on the latest release, open a new issue with fresh steps to reproduce.