remotion-dev/remotion · error · Error

"fps" must be a finite, but you passed ${fps} ${location}

Error message

"fps" must be a finite, but you passed ${fps} ${location}

What it means

`validateFps()` rejects non-finite `fps` values such as `Infinity` or `-Infinity`. These pass the `typeof === 'number'` check but are not usable as a frame rate because Remotion divides durations by fps and indexes frames by integer math.

Source

Thrown at packages/core/src/validation/validate-fps.ts:13

export function validateFps(
	fps: unknown,
	location: string,
	isGif: boolean,
): asserts fps is number {
	if (typeof fps !== 'number') {
		throw new Error(
			`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`,
		);
	}

	if (!Number.isFinite(fps)) {
		throw new Error(
			`"fps" must be a finite, but you passed ${fps} ${location}`,
		);
	}

	if (isNaN(fps)) {
		throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
	}

	if (fps <= 0) {
		throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
	}

	if (isGif && fps > 50) {
		throw new TypeError(
			`The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif`,
		);
	}
}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Replace the offending value with a concrete finite number such as `30`.
  2. Audit any arithmetic that produces fps and clamp it, e.g. `Number.isFinite(fps) ? fps : 30`.
  3. If fps comes from user input, validate with `Number.isFinite` before passing it to the composition.

Example fix

// before
const fps = someRatio / 0; // Infinity
<Composition fps={fps} ... />
// after
const fps = Number.isFinite(someRatio / 0) ? someRatio / 0 : 30;
<Composition fps={fps} ... />
Defensive patterns

Strategy: validation

Validate before calling

const safeFps = Number.isFinite(rawFps) && typeof rawFps === 'number' ? rawFps : 30;

Type guard

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

Prevention

When it happens

Trigger: Passing `fps={Infinity}`, `fps={-Infinity}`, or the result of an arithmetic operation that overflows (e.g. `fps={1/0}`) into a composition or video config.

Common situations: Computed fps values derived from ratios that divide by zero, or accidental `Math.max(...)` over an empty array returning `-Infinity`.

Related errors


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