CherryHQ/cherry-studio · error · Error
Invalid MCP package upload: file exceeds the 100 MiB size li
Error message
Invalid MCP package upload: file exceeds the 100 MiB size limit
What it means
Thrown by validatePackageUploadPayload when the buffer exceeds MCP_PACKAGE_UPLOAD_MAX_BYTES (100 * 1024 * 1024 = 104857600 bytes, ~100 MiB). The cap protects the main process from memory exhaustion: the buffer is received whole over IPC and converted to a Node Buffer, so an oversized upload holds the full payload in memory. The limit is a hard constant, not configurable.
Source
Thrown at src/main/ai/mcp/McpPackageService.ts:316
}
if (path.extname(trimmedFileName).toLowerCase() !== `.${packageFormat}`) {
throw new Error(`Invalid MCP package upload: expected a .${packageFormat} file`)
}
let buffer: Buffer
if (fileBuffer instanceof ArrayBuffer) {
buffer = Buffer.from(fileBuffer)
} else if (ArrayBuffer.isView(fileBuffer)) {
buffer = Buffer.from(fileBuffer.buffer, fileBuffer.byteOffset, fileBuffer.byteLength)
} else {
throw new Error('Invalid MCP package upload: file buffer must be an ArrayBuffer')
}
if (buffer.byteLength === 0) {
throw new Error('Invalid MCP package upload: file buffer cannot be empty')
}
if (buffer.byteLength > MCP_PACKAGE_UPLOAD_MAX_BYTES) {
throw new Error('Invalid MCP package upload: file exceeds the 100 MiB size limit')
}
return buffer
}
export function applyPlatformOverrides(mcpConfig: any, extractDir: string, userConfig?: Record<string, any>): any {
const platform = process.platform
// Deep-copy the nested env so substitution never mutates the caller's manifest object.
const resolvedConfig = { ...mcpConfig, env: mcpConfig.env ? { ...mcpConfig.env } : mcpConfig.env }
// Apply platform-specific overrides
if (mcpConfig.platform_overrides && mcpConfig.platform_overrides[platform]) {
const override = mcpConfig.platform_overrides[platform]
// Override command if specified
if (override.command) {
resolvedConfig.command = override.command
}View on GitHub (pinned to 726446b54c)
Solutions
- Reduce the package size below 100 MiB: exclude unnecessary node_modules (use a production install), strip source maps, remove large assets.
- If the package legitimately needs more, split it into multiple packages or fetch large assets at runtime rather than bundling them.
- Surface the limit in the renderer UI (check file.size before upload) so the user gets immediate feedback rather than waiting for the IPC round-trip.
Example fix
// renderer - before
const buf = await file.arrayBuffer()
await upload(buf, file.name)
// after
const MAX = 100 * 1024 * 1024
if (file.size > MAX) { setError(`File exceeds ${MAX} bytes`); return }
await upload(await file.arrayBuffer(), file.name) Defensive patterns
Strategy: validation
Validate before calling
const MCP_PACKAGE_UPLOAD_MAX_BYTES = 100 * 1024 * 1024
function isWithinUploadLimit(byteLength: number): boolean {
return byteLength > 0 && byteLength <= MCP_PACKAGE_UPLOAD_MAX_BYTES
} Type guard
function fitsUploadLimit(byteLength: number): boolean {
return byteLength <= 100 * 1024 * 1024
} Prevention
- Surface the 100 MiB limit in the renderer and check file.size before upload so the user gets immediate feedback.
- When authoring packages, run a production install (omit devDependencies) and strip large assets to stay well under the cap.
- Fetch large model weights or assets at runtime rather than bundling them in the package.
When it happens
Trigger: Renderer sent an ArrayBuffer larger than 100 MiB. The IPC layer may itself impose additional limits, but if the payload reaches validatePackageUploadPayload and exceeds 104857600 bytes, this guard fires.
Common situations: User selected a very large package (e.g. one bundling a runtime or large model weights); a developer packaged far more than intended into the .dxt/.mcpb; a build step included node_modules or other bulky artifacts.
Related errors
- Invalid MCP package upload: file name must be a string
- Invalid MCP package upload: file name cannot be empty
- Invalid MCP package upload: file name cannot contain leading
- Invalid MCP package upload: file name cannot contain path se
- Invalid MCP package upload: file name contains unsupported c
AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12).
Data as JSON: /api/errors/8a5296975e60712d.
Report an issue: GitHub.