openclaw - 💡(How to fix) Fix Make MEDIA_MAX_BYTES configurable instead of hardcoded 5MB [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#55074Fetched 2026-04-08 01:32:46
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

MEDIA_MAX_BYTES is hardcoded to 5 * 1024 * 1024 (5MB) in src/media/store.ts:14 with no configuration option to override it. This causes file uploads from messaging channels (e.g. WeCom) to silently fail when the file is slightly over 5MB.

Error Message

[wecom] File downloaded: size=6337241, contentType=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, filename=品牌参考表头.xlsx [wecom] Failed to download file: Error: Media exceeds 5MB limit

Root Cause

MEDIA_MAX_BYTES is hardcoded to 5 * 1024 * 1024 (5MB) in src/media/store.ts:14 with no configuration option to override it. This causes file uploads from messaging channels (e.g. WeCom) to silently fail when the file is slightly over 5MB.

Code Example

[wecom] File downloaded: size=6337241, contentType=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, filename=品牌参考表头.xlsx
[wecom] Failed to download file: Error: Media exceeds 5MB limit

---

openclaw config set media.maxBytes 20971520  # 20MB
RAW_BUFFERClick to expand / collapse

Summary

MEDIA_MAX_BYTES is hardcoded to 5 * 1024 * 1024 (5MB) in src/media/store.ts:14 with no configuration option to override it. This causes file uploads from messaging channels (e.g. WeCom) to silently fail when the file is slightly over 5MB.

Problem

When a user sends a 6.3MB Excel file via WeCom, the gateway logs show:

[wecom] File downloaded: size=6337241, contentType=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, filename=品牌参考表头.xlsx
[wecom] Failed to download file: Error: Media exceeds 5MB limit

The file is successfully downloaded from WeCom's CDN but then rejected by OpenClaw's media store. The message arrives at the AI with empty content, giving the user no actionable feedback about what went wrong.

5MB is quite restrictive for common office documents (Excel, PDF, PowerPoint) which frequently exceed this size.

Affected code paths

  • src/media/store.ts:14MEDIA_MAX_BYTES = 5 * 1024 * 1024 (the constant)
  • src/media/store.ts:227-228downloadToFile() destroys connection on exceed
  • src/media/store.ts:394saveMediaBuffer() checks the same limit
  • src/media/server.ts — imports and uses MEDIA_MAX_BYTES
  • src/auto-reply/reply/stage-sandbox-media.ts — sandbox staging uses the same constant

Proposal

Expose MEDIA_MAX_BYTES as a configurable value, e.g.:

openclaw config set media.maxBytes 20971520  # 20MB

Keep the 5MB default for backward compatibility, but allow self-hosted users to raise the limit based on their needs.

Environment

  • OpenClaw version: 2026.3.20
  • Channel plugin: wecom-openclaw-plugin
  • OS: Linux (self-hosted)

extent analysis

Fix Plan

To fix the issue, we need to expose MEDIA_MAX_BYTES as a configurable value. Here are the steps:

  • Introduce a new configuration option media.maxBytes with a default value of 5 * 1024 * 1024 (5MB)
  • Update src/media/store.ts to use the configurable value instead of the hardcoded constant
  • Update src/media/server.ts and src/auto-reply/reply/stage-sandbox-media.ts to use the configurable value

Example Code

// src/media/store.ts
import { getConfig } from './config';

const MEDIA_MAX_BYTES = getConfig('media.maxBytes', 5 *

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

openclaw - 💡(How to fix) Fix Make MEDIA_MAX_BYTES configurable instead of hardcoded 5MB [1 participants]