remotion-dev/remotion · error · TypeError

The "${nameOfProp}" prop ${location} must be finite, but is

Error message

The "${nameOfProp}" prop ${location} must be finite, but is ${amount}.

What it means

`validateDimension` rejects non-finite (i.e. `Infinity` / `-Infinity`) `width`/`height`. Infinite dimensions would create an unbounded frame buffer; the validator catches them after the NaN check.

Source

Thrown at packages/core/src/validation/validate-dimensions.ts:19

export function validateDimension(
	amount: unknown,
	nameOfProp: string,
	location: string,
): asserts amount is number {
	if (typeof amount !== 'number') {
		throw new Error(
			`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`,
		);
	}

	if (isNaN(amount)) {
		throw new TypeError(
			`The "${nameOfProp}" prop ${location} must not be NaN, but is NaN.`,
		);
	}

	if (!Number.isFinite(amount)) {
		throw new TypeError(
			`The "${nameOfProp}" prop ${location} must be finite, but is ${amount}.`,
		);
	}

	if (amount % 1 !== 0) {
		throw new TypeError(
			`The "${nameOfProp}" prop ${location} must be an integer, but is ${amount}.`,
		);
	}

	if (amount <= 0) {
		throw new TypeError(
			`The "${nameOfProp}" prop ${location} must be positive, but got ${amount}.`,
		);
	}
}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Clamp computed dimensions to real bounds, e.g. `Math.min(Math.max(v, 1), 7680)`.
  2. Use `Number.isFinite()` to reject Infinity before assigning.
  3. Handle empty-array edge cases in min/max aggregation.

Example fix

// before
const width = Math.max(...sizes); // sizes empty -> -Infinity
// after
const width = sizes.length ? Math.max(...sizes) : 1920;
Defensive patterns

Strategy: validation

Validate before calling

if (!Number.isFinite(w)) { throw new Error('width must be finite'); }

Prevention

When it happens

Trigger: Setting `width`/`height` to `Infinity` or a value that evaluates to it, e.g. `1/0`, `Math.max(...[])` (returns -Infinity), or dividing by zero.

Common situations: Computing a dimension from an empty dataset (`Math.max`/`Math.min` of empty arrays); a scaling factor that divides by zero; a malformed calculation in `calculateMetadata`.

Related errors


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