remotion-dev/remotion · error · TypeError

parameter 'diskSizeInMb' must be a number, got a ${typeof di

Error message

parameter 'diskSizeInMb' must be a number, got a ${typeof diskSizeInMb}

What it means

First guard in validateDiskSizeInMb: the parameter must be of type 'number'. Anything else (string, undefined, null, object) throws a TypeError reporting the actual typeof. Subsequent checks (NaN, finite, range, integer) only run after this passes.

Source

Thrown at packages/lambda-client/src/validate-disk-size-in-mb.ts:8

import {
	MAX_EPHEMERAL_STORAGE_IN_MB,
	MIN_EPHEMERAL_STORAGE_IN_MB,
} from './constants';

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

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

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

	if (
		diskSizeInMb < MIN_EPHEMERAL_STORAGE_IN_MB ||
		diskSizeInMb > MAX_EPHEMERAL_STORAGE_IN_MB
	) {

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pass diskSizeInMb as a number literal (e.g., 2048).
  2. Coerce string inputs with Number() before calling, after confirming it is parseable.
  3. Fix JSON/env config to provide an unquoted numeric value.

Example fix

// before
validateDiskSizeInMb(process.env.DISK_SIZE); // '2048' (string)

// after
validateDiskSizeInMb(Number(process.env.DISK_SIZE));
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof diskSizeInMb !== 'number') {
  throw new TypeError(`diskSizeInMb must be a number, got ${typeof diskSizeInMb}`);
}
validateDiskSizeInMb(diskSizeInMb);

Type guard

const isNumber = (v: unknown): v is number => typeof v === 'number';

Prevention

When it happens

Trigger: Calling validateDiskSizeInMb (directly or via deployFunction/render APIs that validate disk size) with a non-number value, e.g. a string '2048', undefined, null, or an object.

Common situations: Reading diskSizeInMb from env/CLI as a string and passing it uncoerced; defaulting to undefined when no config is provided; JSON config with disk size quoted as a string.

Related errors


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