remotion-dev/remotion · error · TypeError

"fps" must be positive, but got ${fps} ${location}

Error message

"fps" must be positive, but got ${fps} ${location}

What it means

`validateFps()` throws a `TypeError` when `fps <= 0` because a video must have at least one frame per second for time math to be meaningful. This is thrown as a `TypeError` (unlike the prior `Error` throws) because a non-positive number is a type-level contract violation for a frame rate.

Source

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

): 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. Set fps to a positive number, conventionally `30` or higher.
  2. Clamp computed values: `const fps = Math.max(1, computed);`.
  3. Inspect the `${location}` to find which composition is at fault.

Example fix

// before
<Composition fps={0} ... />
// after
<Composition fps={30} ... />
Defensive patterns

Strategy: validation

Validate before calling

const fps = Math.max(1, Number(rawFps));

Type guard

const isPositiveFps = (v: unknown): v is number => typeof v === 'number' && v > 0;

Prevention

When it happens

Trigger: Passing `fps={0}`, `fps={-30}`, or any non-positive numeric value into a composition, `<Sequence>`, or any API that ultimately calls `validateFps`.

Common situations: Subtracting from fps accidentally (`fps={base - offset}` where offset exceeds base), defaulting fps to `0` as a placeholder, or sign errors from user input parsing.

Related errors


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