remotion-dev/remotion · error · TypeError

parameter 'memorySizeInMb' must be an integer but got ${memo

Error message

parameter 'memorySizeInMb' must be an integer but got ${memorySizeInMb}

What it means

Thrown by validateMemorySize() when memorySizeInMb is a finite number inside [512, 10240] but has a fractional part. AWS Lambda memory must be allocated in whole-megabyte increments; the function uses `value % 1 !== 0` to detect non-integers.

Source

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

	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. Round the value before passing it: Math.round(memorySizeInMb).
  2. Coerce with Math.floor or Math.ceil and then clamp into [512, 10240].
  3. If the decimal came from a formula, audit the formula and decide on a rounding policy.

Example fix

// before
const memorySizeInMb = totalBudget / lambdaCount; // 2048.5
await renderMediaOnLambda({memorySizeInMb, ...});

// after
const memorySizeInMb = Math.round(totalBudget / lambdaCount);
await renderMediaOnLambda({memorySizeInMb, ...});
Defensive patterns

Strategy: validation

Validate before calling

const memorySizeInMb = Math.round(Number(raw));
await renderMediaOnLambda({memorySizeInMb, ...});

Type guard

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

Prevention

When it happens

Trigger: Passing a memory value computed from a division or average, e.g. memorySizeInMb: 2048.5, or accepting a decimal from a config file / UI slider without rounding.

Common situations: A cost-optimization script that computes memory = budget / lambdaCount and forwards the raw float; parsing a value with parseFloat that yields a decimal.

Related errors


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