remotion-dev/remotion · error · TypeError

The "${nameOfProp}" prop ${location} must be an integer, but

Error message

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

What it means

`validateDimension` requires `width`/`height` to be integers — fractional pixel dimensions are not allowed because frame buffers are addressed in whole pixels. This check runs after the NaN/finite checks.

Source

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

		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. Round the result: `Math.round(value)`.
  2. Choose aspect ratios that divide evenly, or pick the nearest integer.
  3. Validate with `Number.isInteger()` before assigning.

Example fix

// before
const height = width * (9 / 16); // fractional for many widths
<Composition width={width} height={height} ... />
// after
const height = Math.round(width * (9 / 16));
<Composition width={width} height={height} ... />
Defensive patterns

Strategy: validation

Validate before calling

if (w % 1 !== 0) { throw new Error('width must be an integer'); }

Prevention

When it happens

Trigger: Setting `width`/`height` to a fractional number such as `1920.5`, or deriving a dimension from a division that is not a whole number (`1920 / 2` is fine, `1920 / 3 = 640` is fine, but `1000 / 3 ≈ 333.33` is not).

Common situations: Scaling dimensions by an aspect ratio that yields non-integer results; computing height from width and a non-divisor ratio; rounding omissions in responsive layout code.

Related errors


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