remotion-dev/remotion · error · Error

Remote asset exceeds the 50MB size limit

Error message

Remote asset exceeds the 50MB size limit

What it means

Thrown by downloadRemoteAsset in @remotion/browser-studio when the asset exceeds maxRemoteAssetSize (50MB). It is checked three ways: a Content-Length header that already exceeds the limit (download is aborted immediately), a fully-buffered body that is too large, and a running byte count while streaming that crosses the limit (stream is cancelled). The cap keeps oversized payloads out of the in-browser virtual project.

Source

Thrown at packages/browser-studio/src/download-remote-asset.ts:77

			if (error instanceof Error && error.name === 'AbortError') {
				throw new Error('Timed out downloading remote asset');
			}

			throw new Error(
				`Could not fetch remote asset. The URL may not allow cross-origin requests (CORS): ${
					error instanceof Error ? error.message : String(error)
				}`,
			);
		}

		if (!response.ok) {
			throw new Error(`Could not download remote asset: ${response.status}`);
		}

		const contentLength = response.headers.get('content-length');
		if (contentLength !== null && Number(contentLength) > maxRemoteAssetSize) {
			abortController.abort();
			throw new Error('Remote asset exceeds the 50MB size limit');
		}

		if (!response.body) {
			const buffer = await response.arrayBuffer();
			if (buffer.byteLength > maxRemoteAssetSize) {
				throw new Error('Remote asset exceeds the 50MB size limit');
			}

			contents = new Uint8Array(buffer);
		} else {
			const reader = response.body.getReader();
			const chunks: Uint8Array[] = [];
			let size = 0;

			while (true) {
				const {done, value} = await reader.read();
				if (done) {
					break;

View on GitHub (pinned to 10db9de073)

Solutions

  1. Downscale/compress the image below 50MB (e.g. export as WebP/JPEG) and import that
  2. Host a properly sized derivative and import its URL instead
  3. If you control the pipeline, pre-process assets server-side before they reach Browser Studio
  4. Do not retry the same URL — the size check is deterministic while the file is unchanged

Example fix

// before
await operations.downloadRemoteAsset({url: rawPhotoUrl}); // 80MB TIFF -> rejects

// after
const head = await fetch(rawPhotoUrl, {method: 'HEAD'});
const size = Number(head.headers.get('content-length') ?? 0);
if (size > 50 * 1024 * 1024) {
  throw new Error('Image is over 50MB — compress it before importing');
}
await operations.downloadRemoteAsset({url: rawPhotoUrl});
Defensive patterns

Strategy: validation

Validate before calling

const head = await fetch(url, {method: 'HEAD'});
const len = Number(head.headers.get('content-length') ?? 0);
if (len > 50 * 1024 * 1024) {
  throw new Error('Image exceeds the 50MB import limit — compress it first');
}
await operations.downloadRemoteAsset({url});

Try / catch

try { await operations.downloadRemoteAsset({url}); } catch (error) { if (error instanceof Error && error.message.includes('50MB size limit')) { /* prompt user to compress */ } else throw error; }

Prevention

When it happens

Trigger: Calling `downloadRemoteAsset({url})` for an image whose Content-Length > 50MB; a server omitting Content-Length and streaming more than 50MB; uncompressed TIFF/raw photos or huge PNGs from a camera or design tool.

Common situations: Users importing print-resolution or raw camera images; servers reporting wrong Content-Length; multi-frame sprite sheets.

Related errors


AI-assisted analysis of remotion-dev/remotion@10db9de073 (2026-08-22). Data as JSON: /api/errors/ec716aecb5ec09a4. Report an issue: GitHub.