remotion-dev/remotion · error · TypeError

"seed" must be a finite number, but got ${JSON.stringify(see

Error message

"seed" must be a finite number, but got ${JSON.stringify(seed)}

What it means

LightLeak validates its seed prop at render time and throws a TypeError if seed is not a number or is not finite (NaN, Infinity). The seed drives the deterministic pseudo-randomness of the light-leak texture, so a non-finite value would break reproducibility.

Source

Thrown at packages/light-leaks/src/LightLeak.tsx:276

	...Internals.premountSchema,
} as const satisfies InteractivitySchema;

const LightLeakInner: React.FC<
	LightLeakProps & {
		readonly controls: SequenceControls | undefined;
	}
> = ({
	seed = 0,
	hueShift = 0,
	durationInFrames,
	style,
	controls,
	...sequenceProps
}) => {
	const {durationInFrames: videoDuration} = useVideoConfig();
	const resolvedDuration = durationInFrames ?? videoDuration;
	if (typeof seed !== 'number' || !Number.isFinite(seed)) {
		throw new TypeError(
			`"seed" must be a finite number, but got ${JSON.stringify(seed)}`,
		);
	}

	if (typeof hueShift !== 'number' || !Number.isFinite(hueShift)) {
		throw new TypeError(
			`"hueShift" must be a finite number, but got ${JSON.stringify(hueShift)}`,
		);
	}

	if (hueShift < 0 || hueShift > 360) {
		throw new RangeError(
			`"hueShift" must be between 0 and 360, but got ${hueShift}`,
		);
	}

	return (
		<Sequence

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Coerce seed to a finite number before passing: Number(seed) and guard with Number.isFinite.
  2. Default seed to 0 when the source value is missing.
  3. If animating seed, use interpolate() with extrapolateLeft:'clamp'/extrapolateRight:'clamp'.

Example fix

// before
<LightLeak seed={seedStr} />
// after
const seedNum = Number(seedStr);
<LightLeak seed={Number.isFinite(seedNum) ? seedNum : 0} />
Defensive patterns

Strategy: validation

Validate before calling

function toSeed(v: unknown): number {
  const n = typeof v === 'number' ? v : Number(v);
  return Number.isFinite(n) ? n : 0;
}

Type guard

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

Prevention

When it happens

Trigger: Passing seed as a string (e.g. from a URL param), undefined arithmetic that yields NaN, Infinity from a divide-by-zero, or null.

Common situations: Reading seed from query params without Number(); computing seed = a/b where b can be 0; passing a prop from a CMS as a string.

Related errors


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