remotion-dev/remotion · error · TypeError

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

Error message

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

What it means

Thrown by assertRequiredFiniteNumber when a value is not a number, is NaN, or is Infinity/-Infinity. This validator is used by effects that mandate a numeric param with no default — currently the wave effect (wave/index.ts:82) and similar effects with required numeric fields. Number.isFinite rejects NaN and Infinity, so only true finite numbers pass.

Source

Thrown at packages/effects/src/validate-effect-param.ts:17

export const assertEffectParamsObject = (
	params: unknown,
	effectLabel: string,
): void => {
	if (params === null || typeof params !== 'object') {
		throw new TypeError(
			`${effectLabel} effect requires a parameters object, but got ${JSON.stringify(params)}`,
		);
	}
};

export const assertRequiredFiniteNumber = (
	value: unknown,
	name: string,
): void => {
	if (typeof value !== 'number' || !Number.isFinite(value)) {
		throw new TypeError(
			`"${name}" must be a finite number, but got ${JSON.stringify(value)}`,
		);
	}
};

export const assertRequiredColor = (value: unknown, name: string): void => {
	if (typeof value !== 'string' || value.length === 0) {
		throw new TypeError(
			`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`,
		);
	}
};

export const assertOptionalColor = (value: unknown, name: string): void => {
	if (value === undefined) {
		return;
	}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Provide a finite number for the required field: wave({frequency: 2})
  2. Sanitize computed values with Number.isFinite before passing them: effect({x: Number.isFinite(v) ? v : 0})
  3. Guard parseFloat/parseInt results: if the source string is non-numeric, provide a fallback finite value
  4. Check the effect's TypeScript type — the field will be marked as required (non-optional) number

Example fix

// before
const e = wave({frequency: NaN});

// after
const freq = Number.isFinite(raw) ? raw : 1;
const e = wave({frequency: freq});
Defensive patterns

Strategy: validation

Validate before calling

function isFiniteNumber(value: unknown): value is number {
  return typeof value === 'number' && Number.isFinite(value);
}

// Before calling:
if (!isFiniteNumber(params.frequency)) {
  throw new Error('frequency must be a finite number');
}
const e = wave(params);

Type guard

function isFiniteNumber(value: unknown): value is number {
  return typeof value === 'number' && Number.isFinite(value);
}

Prevention

When it happens

Trigger: Calling an effect like wave with a missing or non-numeric required field (e.g. wave({}) when wave requires a number), or passing NaN/Infinity computed from bad math (e.g. 1/0, parseInt('abc'), parseFloat(undefined)).

Common situations: Param computed from user input that was not sanitized; division by zero producing Infinity; parseInt on a non-numeric string producing NaN; a required field was added to the effect type but existing call sites were not updated.

Related errors


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