remotion-dev/remotion · error · TypeError

The "trimBefore" prop of <Sequence /> must be finite, but it

Error message

The "trimBefore" prop of <Sequence /> must be finite, but it is ${trimBefore}.

What it means

Thrown when trimBefore is Infinity or -Infinity. Infinite trim values produce nonsensical sequence offsets and would break frame scheduling, so Remotion requires a finite number.

Source

Thrown at packages/core/src/Sequence.tsx:249

		throw new TypeError(
			`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof trimBefore}, but it must be a number.`,
		);
	}

	if (trimBefore < 0) {
		throw new TypeError(
			`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${trimBefore}.`,
		);
	}

	if (Number.isNaN(trimBefore)) {
		throw new TypeError(
			'The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.',
		);
	}

	if (!Number.isFinite(trimBefore)) {
		throw new TypeError(
			`The "trimBefore" prop of <Sequence /> must be finite, but it is ${trimBefore}.`,
		);
	}

	if (typeof freeze !== 'undefined' && freeze !== null) {
		if (typeof freeze !== 'number') {
			throw new TypeError(
				`The "freeze" prop of <Sequence /> must be a number, but is of type ${typeof freeze}.`,
			);
		}

		if (Number.isNaN(freeze)) {
			throw new TypeError(
				`The "freeze" prop of <Sequence /> must be a real number, but it is NaN.`,
			);
		}

		if (!Number.isFinite(freeze)) {

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Guard with Number.isFinite(trimBefore) before rendering.
  2. Cap the value with Math.min(trimBefore, maxFrames).
  3. Audit the upstream computation that produced Infinity.

Example fix

// before
<Sequence trimBefore={computed} />

// after
<Sequence trimBefore={Number.isFinite(computed) ? computed : 0} />
Defensive patterns

Strategy: validation

Validate before calling

const safe = Number.isFinite(trimBefore) ? trimBefore : 0;

Type guard

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

Prevention

When it happens

Trigger: trimBefore comes from a division that overflowed, an unbounded sum, or a default of Infinity propagated into the prop.

Common situations: Spreading default-laden objects whose trimBefore defaulted to Infinity; summing an empty array (returns 0 but related ops can diverge); loading from JSON that explicitly contains Infinity-like strings.

Related errors


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