remotion-dev/remotion · error · TypeError

parameter 'memorySizeInMb' must be between ${MIN_MEMORY} and

Error message

parameter 'memorySizeInMb' must be between ${MIN_MEMORY} and ${MAX_MEMORY}, but got ${memorySizeInMb}

What it means

Thrown by validateMemorySize() when memorySizeInMb is a finite number but outside the AWS-supported range of 512 to 10240 MB. Lambda only accepts memory in that band, incremented in 1 MB steps. The error message interpolates the offending value and the legal bounds.

Source

Thrown at packages/lambda-client/src/validate-memory-size.ts:21

export const validateMemorySize = (memorySizeInMb: unknown) => {
	if (typeof memorySizeInMb !== 'number') {
		throw new TypeError(
			`parameter 'memorySizeInMb' must be a number, got a ${typeof memorySizeInMb}`,
		);
	}

	if (Number.isNaN(memorySizeInMb)) {
		throw new TypeError(`parameter 'memorySizeInMb' must not be NaN, but is`);
	}

	if (!Number.isFinite(memorySizeInMb)) {
		throw new TypeError(
			`parameter 'memorySizeInMb' must be finite, but is ${memorySizeInMb}`,
		);
	}

	if (memorySizeInMb < MIN_MEMORY || memorySizeInMb > MAX_MEMORY) {
		throw new TypeError(
			`parameter 'memorySizeInMb' must be between ${MIN_MEMORY} and ${MAX_MEMORY}, but got ${memorySizeInMb}`,
		);
	}

	if (memorySizeInMb % 1 !== 0) {
		throw new TypeError(
			`parameter 'memorySizeInMb' must be an integer but got ${memorySizeInMb}`,
		);
	}
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Set memorySizeInMb to a value within [512, 10240]; use DEFAULT_MEMORY_SIZE (2048) if unsure.
  2. Clamp user-supplied input: Math.min(Math.max(value, 512), 10240).
  3. If you need more than 10240 MB, you cannot get it from a single Lambda — review framesPerLambda and concurrency instead of raising memory.

Example fix

// before
await renderMediaOnLambda({memorySizeInMb: 256, ...});

// after
await renderMediaOnLambda({memorySizeInMb: 2048, ...});
Defensive patterns

Strategy: validation

Validate before calling

const clampMemory = (v: number) => Math.min(Math.max(v, 512), 10240);
await renderMediaOnLambda({memorySizeInMb: clampMemory(userMemory), ...});

Type guard

const isMemorySize = (v: unknown): v is number =>
  typeof v === 'number' && v >= 512 && v <= 10240 && v % 1 === 0 && Number.isFinite(v);

Prevention

When it happens

Trigger: Calling renderMediaOnLambda({memorySizeInMb: 256}) (below the floor), memorySizeInMb: 20480 (above the ceiling), or any value computed from user input that was never clamped.

Common situations: Assuming smaller memory saves cost (256 MB is below the minimum Lambda allows for Remotion); hardcoding a value copied from a non-Lambda tutorial; auto-scaling logic that pushes memory beyond 10 GB.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/cef85deceb86e00a. Report an issue: GitHub.