openclaw - 💡(How to fix) Fix [Bug]: MediaOffloadError: EPERM operation not permitted, fsync [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#76977Fetched 2026-05-04 04:59:51
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
2
Author
Timeline (top)
commented ×2labeled ×2closed ×1cross-referenced ×1

Error Message

[gateway] chat.send attachment parse/stage failed: MediaOffloadError: [Gateway Error] Failed to save intercepted media to disk: EPERM: operation not permitted, fsync

[ws] ⇄ res ✗ chat.send errorCode=UNAVAILABLE errorMessage=MediaOffloadError: [Gateway Error] Failed to save intercepted media to disk: EPERM: operation not permitted, fsync

Root Cause

Call stack (from log):
  at parseMessageWithAttachments (attachment-normalize-CbCI4lY1.js:147)
  at async chat.send (chat-BSB08gN6.js:1673)
  at async handleGatewayRequest (server-methods-BIuCGe_p.js:11565)
Caused by: Error: EPERM: operation not permitted, fsync
  at async fsync (node:internal/fs/promises:842)
  at async fsCall (node:internal/fs/promises:468)
  at async store-CNJ_8Iba.js:238
  at async retryAfterRecreatingDir (store-CNJ_8Iba.js:95)
  at async writeSavedMediaBuffer (store-CNJ_8Iba.js:232)
  at async saveMediaBuffer (store-CNJ_8Iba.js:344)

Fix Action

Workaround

Copying the file manually to the workspace folder and referencing it by full path in the chat works without issues. The bug is isolated to the attachment staging pipeline.

Code Example

Call stack (from log):
  at parseMessageWithAttachments (attachment-normalize-CbCI4lY1.js:147)
  at async chat.send (chat-BSB08gN6.js:1673)
  at async handleGatewayRequest (server-methods-BIuCGe_p.js:11565)
Caused by: Error: EPERM: operation not permitted, fsync
  at async fsync (node:internal/fs/promises:842)
  at async fsCall (node:internal/fs/promises:468)
  at async store-CNJ_8Iba.js:238
  at async retryAfterRecreatingDir (store-CNJ_8Iba.js:95)
  at async writeSavedMediaBuffer (store-CNJ_8Iba.js:232)
  at async saveMediaBuffer (store-CNJ_8Iba.js:344)

Node.js: 22.20.0
OS: Windows 11 (hostname: NANITO-RYZEN)
Reproducible: 100% — every attachment attempt fails
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Bug Description

When attaching a PDF file via the Control UI chat interface on Windows, the gateway fails with a MediaOffloadError during the fsync operation when trying to stage the attachment to disk.

Error Message

[gateway] chat.send attachment parse/stage failed: MediaOffloadError: [Gateway Error] Failed to save intercepted media to disk: EPERM: operation not permitted, fsync

[ws] ⇄ res ✗ chat.send errorCode=UNAVAILABLE errorMessage=MediaOffloadError: [Gateway Error] Failed to save intercepted media to disk: EPERM: operation not permitted, fsync

Environment

  • OS: Windows 11
  • OpenClaw version: 2026.5.3-beta.2 (315a933)
  • Gateway mode: local
  • Node.js: (run node --version to confirm)
  • File type tested: PDF

Steps to reproduce

  1. Start gateway normally
  2. Open Control UI webchat
  3. Attach a PDF file using the attachment button
  4. Send the message

Expected behavior

PDF is staged and sent to the model successfully.

Actual behavior

Gateway throws MediaOffloadError with EPERM fsync error. File is never processed.

OpenClaw version

OpenClaw 2026.5.3-beta.2 (315a933) and OpenClaw 2026.5.2

Operating system

Windows 10 pro 64bit

Install method

npm global

Model

openai-codex

Provider / routing chain

Local gateway (loopback) → Control UI webchat → chat.send → attachment parse/stage → EPERM

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Call stack (from log):
  at parseMessageWithAttachments (attachment-normalize-CbCI4lY1.js:147)
  at async chat.send (chat-BSB08gN6.js:1673)
  at async handleGatewayRequest (server-methods-BIuCGe_p.js:11565)
Caused by: Error: EPERM: operation not permitted, fsync
  at async fsync (node:internal/fs/promises:842)
  at async fsCall (node:internal/fs/promises:468)
  at async store-CNJ_8Iba.js:238
  at async retryAfterRecreatingDir (store-CNJ_8Iba.js:95)
  at async writeSavedMediaBuffer (store-CNJ_8Iba.js:232)
  at async saveMediaBuffer (store-CNJ_8Iba.js:344)

Node.js: 22.20.0
OS: Windows 11 (hostname: NANITO-RYZEN)
Reproducible: 100% — every attachment attempt fails

Impact and severity

  • Affected: All Windows users attempting to attach files via the Control UI webchat
  • Severity: Blocks workflow — file attachment feature is completely non-functional
  • Frequency: Always reproducible (100% failure rate on every attempt)
  • Consequence: Cannot send documents to the model via UI; workaround requires manual file copy to workspace and path reference, which is not intuitive for non-technical users

Additional information

Workaround

Copying the file manually to the workspace folder and referencing it by full path in the chat works without issues. The bug is isolated to the attachment staging pipeline.

Notes

  • Folder permissions are correct (FullControl for user, Administrators, SYSTEM)
  • Running as Administrator does not resolve the issue
  • Disk has no errors (fsutil dirty query returns clean)
  • This is different from #52093 which involves EPERM on rename — this error occurs specifically on fsync during media offload/staging
  • Enabling the nano-pdf skill did not resolve the issue

extent analysis

TL;DR

The most likely fix involves addressing the EPERM error on fsync during media offload/staging by checking and adjusting file system permissions or handling the error in the store-CNJ_8Iba.js script.

Guidance

  • Verify that the issue is indeed related to file system permissions by checking the permissions of the directory where the file is being staged.
  • Investigate the store-CNJ_8Iba.js script, specifically the fsync call, to see if there's a way to handle the EPERM error or adjust the permissions programmatically.
  • Consider implementing a try-catch block around the fsync call to catch and handle the EPERM error, potentially retrying the operation or using an alternative method.
  • Review the differences between the working manual file copy workaround and the failing attachment staging pipeline to identify potential discrepancies in file handling or permissions.

Example

try {
  await fsync(fileDescriptor);
} catch (error) {
  if (error.code === 'EPERM') {
    // Handle EPERM error, potentially retrying or using an alternative method
    console.error('EPERM error on fsync:', error);
  } else {
    throw error;
  }
}

Notes

  • The issue seems to be specific to the attachment staging pipeline and does not occur when manually copying the file to the workspace folder.
  • Running as Administrator does not resolve the issue, suggesting that the problem may not be solely related to user permissions.

Recommendation

Apply a workaround by modifying the store-CNJ_8Iba.js script to handle the EPERM error on fsync, as the root cause of the issue is not immediately clear and may require further investigation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

PDF is staged and sent to the model successfully.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: MediaOffloadError: EPERM operation not permitted, fsync [2 comments, 3 participants]