remotion-dev/remotion · error · Error

posterize must be a positive finite number, but got ${poster

Error message

posterize must be a positive finite number, but got ${posterize}

What it means

Thrown by assertValidInterpolatePosterizeOption. The posterize option controls how many discrete steps the interpolated output is snapped to; it must be a finite number strictly greater than 0. Zero, negatives, NaN, Infinity, and non-numbers are all rejected.

Source

Thrown at packages/core/src/interpolate.ts:1076

		if (typeof easing[i] !== 'function') {
			throw new Error(`easing[${i}] must be a function`);
		}
	}
}

export function assertValidInterpolatePosterizeOption(
	posterize: number | undefined,
) {
	if (posterize === undefined) {
		return;
	}

	if (
		typeof posterize !== 'number' ||
		!Number.isFinite(posterize) ||
		posterize <= 0
	) {
		throw new Error(
			`posterize must be a positive finite number, but got ${posterize}`,
		);
	}
}

function assertValidInterpolateOutputOption(
	output: InterpolateOptions['output'],
) {
	if (
		output === undefined ||
		output === 'linear' ||
		output === 'perceptual-scale'
	) {
		return;
	}

	throw new Error(
		`output must be "linear" or "perceptual-scale", but got ${String(output)}`,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Set posterize to a positive finite integer (e.g. 8 or 10).
  2. Clamp the computed posterize to a minimum of 1 before passing it.
  3. Omit the option entirely if you do not need stepped output.

Example fix

// before
const r = interpolate(t, [0, 1], [0, 100], {posterize: 0});
// after
const r = interpolate(t, [0, 1], [0, 100], {posterize: 8});
Defensive patterns

Strategy: validation

Validate before calling

if (
  posterize !== undefined &&
  (typeof posterize !== 'number' || !Number.isFinite(posterize) || posterize <= 0)
) {
  throw new Error('posterize must be a positive finite number');
}
const r = interpolate(input, inputRange, outputRange, {posterize});

Type guard

const isValidPosterize = (p: unknown): p is number | undefined =>
  p === undefined || (typeof p === 'number' && Number.isFinite(p) && p > 0);

Prevention

When it happens

Trigger: interpolate(t, [0,1], [0,100], {posterize: 0}); {posterize: -4}; {posterize: NaN}; {posterize: '5'}; computing posterize from a config that defaults to 0.

Common situations: Tying posterize to a dynamic value that can hit 0 (e.g. a slider's minimum); passing a string from user input; Infinity from an unchecked division.

Related errors


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