remotion-dev/remotion · error · RangeError

Frame ${frame} is not finite

Error message

Frame ${frame} is not finite

What it means

validateFrame throws a RangeError when frame is a number but not finite — specifically NaN, Infinity, or -Infinity (Number.isFinite is false). These usually arrive from arithmetic gone wrong (division by zero, parse failures, unbounded math).

Source

Thrown at packages/core/src/validate-frame.ts:21

	durationInFrames,
	frame,
}: {
	frame: number;
	durationInFrames: number;
	allowFloats: boolean;
}) => {
	if (typeof frame === 'undefined') {
		throw new TypeError(`Argument missing for parameter "frame"`);
	}

	if (typeof frame !== 'number') {
		throw new TypeError(
			`Argument passed for "frame" is not a number: ${frame}`,
		);
	}

	if (!Number.isFinite(frame)) {
		throw new RangeError(`Frame ${frame} is not finite`);
	}

	if (frame % 1 !== 0 && !allowFloats) {
		throw new RangeError(
			`Argument for frame must be an integer, but got ${frame}`,
		);
	}

	if (frame < 0 && frame < -durationInFrames) {
		throw new RangeError(
			`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`,
		);
	}

	if (frame > durationInFrames - 1) {
		throw new RangeError(
			`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${
				durationInFrames - 1

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Guard the arithmetic: `const frame = Number.isFinite(raw) ? raw : 0;`.
  2. Check inputs upstream (fps, duration) for zero/NaN before computing frame.
  3. Use `typeof x === 'number' && !Number.isNaN(x)` validation on parsed values.
  4. Log the intermediate values at the call site to find where NaN/Infinity originates.

Example fix

// before
const frame = position / fps; // fps is 0 -> Infinity

// after
const frame = fps > 0 ? position / fps : 0;
Defensive patterns

Strategy: type-guard

Validate before calling

if (!Number.isFinite(frame)) {
  frame = 0; // or handle the error case
}
validateFrame({ frame, durationInFrames, allowFloats });

Type guard

const isFiniteFrame = (f: unknown): f is number => typeof f === 'number' && Number.isFinite(f);

Prevention

When it happens

Trigger: Dividing by zero or by a duration of zero; parseFloat on a non-numeric string yields NaN; multiplication producing Infinity; chained math where an intermediate step overflowed.

Common situations: Computing frame = currentTime * fps where currentTime is NaN; parseFloat('') -> NaN; dividing by fps that defaulted to 0; math on optional fields that resolved to undefined then to NaN.

Related errors


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