openclaw - 💡(How to fix) Fix Sandbox media staging: hardcoded 5MB MEDIA_MAX_BYTES limit prevents large file transfers [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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#55068Fetched 2026-04-08 01:32:52
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

The sandbox media staging logic hardcodes MEDIA_MAX_BYTES = 5 * 1024 * 1024 (5MB), which prevents files larger than 5MB (e.g. large PPTs, PDFs, media files) from being copied into the sandbox container. There is no configuration option to override this limit.

Root Cause

The sandbox media staging logic hardcodes MEDIA_MAX_BYTES = 5 * 1024 * 1024 (5MB), which prevents files larger than 5MB (e.g. large PPTs, PDFs, media files) from being copied into the sandbox container. There is no configuration option to override this limit.

Fix Action

Workaround

Currently requires manually patching dist/store-*.js and dist/plugin-sdk/store-*.js after every npm update openclaw:

sed -i "s/const MEDIA_MAX_BYTES = 5 \\* 1024 \\* 1024/const MEDIA_MAX_BYTES = 500 * 1024 * 1024/" dist/store-*.js dist/plugin-sdk/store-*.js
openclaw gateway restart

This is fragile and must be re-applied after every update.

Code Example

const MEDIA_MAX_BYTES = 5 * 1024 * 1024;

---

sed -i "s/const MEDIA_MAX_BYTES = 5 \\* 1024 \\* 1024/const MEDIA_MAX_BYTES = 500 * 1024 * 1024/" dist/store-*.js dist/plugin-sdk/store-*.js
openclaw gateway restart

---

const MEDIA_MAX_BYTES = parseInt(process.env.OPENCLAW_MEDIA_MAX_BYTES) || 100 * 1024 * 1024;
RAW_BUFFERClick to expand / collapse

Summary

The sandbox media staging logic hardcodes MEDIA_MAX_BYTES = 5 * 1024 * 1024 (5MB), which prevents files larger than 5MB (e.g. large PPTs, PDFs, media files) from being copied into the sandbox container. There is no configuration option to override this limit.

Current Behavior

In dist/store-*.js and dist/plugin-sdk/store-*.js, the constant is hardcoded:

const MEDIA_MAX_BYTES = 5 * 1024 * 1024;

When a file exceeds 5MB, the staging step fails and the file cannot be made available inside the sandbox. This blocks many real-world use cases — generated PPTs, large images, audio/video files, etc.

Expected Behavior

  • The MEDIA_MAX_BYTES limit should be configurable (e.g. via an environment variable like OPENCLAW_MEDIA_MAX_BYTES or a config field)
  • The default should be significantly higher (50MB–100MB or more) to accommodate common file types
  • At minimum, the hardcoded value should be raised from 5MB to something more practical

Workaround

Currently requires manually patching dist/store-*.js and dist/plugin-sdk/store-*.js after every npm update openclaw:

sed -i "s/const MEDIA_MAX_BYTES = 5 \\* 1024 \\* 1024/const MEDIA_MAX_BYTES = 500 * 1024 * 1024/" dist/store-*.js dist/plugin-sdk/store-*.js
openclaw gateway restart

This is fragile and must be re-applied after every update.

Suggestion

Make MEDIA_MAX_BYTES configurable, e.g.:

const MEDIA_MAX_BYTES = parseInt(process.env.OPENCLAW_MEDIA_MAX_BYTES) || 100 * 1024 * 1024;

extent analysis

Fix Plan

To address the issue, we will make the MEDIA_MAX_BYTES limit configurable via an environment variable. Here are the steps:

  • Update the dist/store-*.js and dist/plugin-sdk/store-*.js files to use the environment variable:
const MEDIA_MAX_BYTES = parseInt(process.env.OPENCLAW_MEDIA_MAX_BYTES) || 50 * 1024 * 1024;
  • Set the OPENCLAW_MEDIA_MAX_BYTES environment variable to the desired value (e.g., 50MB) in your deployment configuration.
  • Remove any existing workarounds, such as the sed command.

Verification

To verify the fix, you can:

  • Upload a file larger than the previous limit (5MB) to the sandbox container.
  • Check that the file is successfully copied and available inside the sandbox.
  • Test with different file sizes and types to ensure the new limit is working as expected.

Extra Tips

  • Consider adding input validation to ensure the OPENCLAW_MEDIA_MAX_BYTES environment variable is a positive integer.
  • You can also add a configuration option to set the default value of MEDIA_MAX_BYTES in case the environment variable is not set.
  • Make sure to update any documentation or guides to reflect the new configurable limit.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING