remotion-dev/remotion · error · TypeError

extrapolateRight: "identity" is not supported for non-numeri

Error message

extrapolateRight: "identity" is not supported for non-numeric strings

What it means

Thrown by interpolateDiscreteString when input exceeds the last inputRange value and options.extrapolateRight is 'identity'. As with the left side, identity extrapolation has no meaningful numeric return for a non-numeric string outputRange, so it is rejected.

Source

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

		if (options?.extrapolateLeft === 'identity') {
			throw new TypeError(
				'extrapolateLeft: "identity" is not supported for non-numeric strings',
			);
		}

		if (options?.extrapolateLeft === 'wrap') {
			const wrapRange = inputMax - inputMin;
			resolvedInput =
				((((resolvedInput - inputMin) % wrapRange) + wrapRange) % wrapRange) +
				inputMin;
		} else {
			return outputRange[0];
		}
	}

	if (resolvedInput > inputMax) {
		if (options?.extrapolateRight === 'identity') {
			throw new TypeError(
				'extrapolateRight: "identity" is not supported for non-numeric strings',
			);
		}

		if (options?.extrapolateRight === 'wrap') {
			const wrapRange = inputMax - inputMin;
			resolvedInput =
				((((resolvedInput - inputMin) % wrapRange) + wrapRange) % wrapRange) +
				inputMin;
		} else {
			return outputRange[outputRange.length - 1];
		}
	}

	const range = findRange(resolvedInput, inputRange);
	return resolvedInput >= inputRange[range + 1]
		? outputRange[range + 1]
		: outputRange[range];

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Use extrapolateRight: 'clamp' (returns the last output), 'extend', or 'wrap'.
  2. Clamp the input before calling interpolate().

Example fix

// before
interpolate(t, [0, 1], ["red", "blue"], {
  easing: Easing.step1,
  extrapolateRight: 'identity',
});
// after
interpolate(t, [0, 1], ["red", "blue"], {
  easing: Easing.step1,
  extrapolateRight: 'clamp',
});
Defensive patterns

Strategy: validation

Validate before calling

function isDiscreteStringRange(outputRange: readonly (string | number)[]): boolean {
  return outputRange.some((o) => typeof o === 'string'
    && o.trim().split(/\s+/).some((p) => !/^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/.test(p)
      && !/^(left|right|top|bottom|center)$/i.test(p)));
}

if (isDiscreteStringRange(outputRange) && options?.extrapolateRight === 'identity') {
  throw new Error('Use extrapolateRight: clamp|extend|wrap for discrete strings');
}

Prevention

When it happens

Trigger: interpolate(t, [0, 1], ["red", "blue"], {easing: Easing.step1, extrapolateRight: 'identity'}) called with t > 1.

Common situations: Carrying 'identity' right-extrapolation over from a numeric interpolate() call to a discrete string call; ranges where the input can overshoot the top.

Related errors


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