remotion-dev/remotion · error · TypeError

The argument "fps" was not provided

Error message

The argument "fps" was not provided

What it means

Thrown by getVisualization when fps is falsy (0, undefined, NaN, null). The fps is used to convert a frame index into a sample position via frame/fps; a missing or zero fps would divide by zero or produce NaN, so the guard rejects it early.

Source

Thrown at packages/media-utils/src/fft/get-visualization.ts:39

}: {
	sampleSize: number;
	data: Float32Array;
	frame: number;
	sampleRate: number;
	fps: number;
	maxInt: number;
	optimizeFor: OptimizeFor;
	dataOffsetInSeconds: number;
}): number[] => {
	const isPowerOfTwo = sampleSize > 0 && (sampleSize & (sampleSize - 1)) === 0;
	if (!isPowerOfTwo) {
		throw new TypeError(
			`The argument "bars" must be a power of two. For example: 64, 128. Got instead: ${sampleSize}`,
		);
	}

	if (!fps) {
		throw new TypeError('The argument "fps" was not provided');
	}

	if (data.length < sampleSize) {
		throw new TypeError(
			'Audio data is not big enough to provide ' + sampleSize + ' bars.',
		);
	}

	const start = Math.floor((frame / fps - dataOffsetInSeconds) * sampleRate);

	const actualStart = Math.max(0, start - sampleSize / 2);

	const ints = new Int16Array({
		length: sampleSize,
	});
	ints.set(
		data.subarray(actualStart, actualStart + sampleSize).map((x) => toInt16(x)),
	);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Always pass a positive fps derived from the composition: const { fps } = useVideoConfig();
  2. Default fps to a sane positive value (e.g. 30) if your API allows it.
  3. Validate fps > 0 before calling getVisualization and surface a clearer error upstream.

Example fix

// before
getVisualization({ sampleSize: 128, fps: 0, ... });

// after
const { fps } = useVideoConfig();
getVisualization({ sampleSize: 128, fps, ... });
Defensive patterns

Strategy: validation

Validate before calling

if (!fps || fps <= 0) throw new TypeError('fps must be a positive number');
getVisualization({ sampleSize, fps, ...rest });

Type guard

const isValidFps = (f: unknown): f is number => typeof f === 'number' && f > 0 && Number.isFinite(f);

Try / catch

try { return getVisualization({ sampleSize, fps, ...rest }); } catch (e) { if (/fps" was not provided/.test(String((e as Error).message))) { return getVisualization({ sampleSize, fps: 30, ...rest }); } throw e; }

Prevention

When it happens

Trigger: Calling the visualization API without passing fps, or passing fps: 0. Common when wrapping the API and forgetting to forward the composition's fps, or when fps is read from a config that defaults to 0.

Common situations: Remotion composition code that forgets to pass fps from useVideoConfig(). A default fps of 0 in a config object. Reading fps from metadata that failed to load.

Related errors


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