remotion-dev/remotion · error · TypeError
Cannot interpolate font weight
Error message
Cannot interpolate font weight "${output}". Expected "normal", "bold", or a number between 1 and 1000 What it means
interpolate() can animate CSS font-weight values, which must be 'normal' (400), 'bold' (700), or a number 1–1000. If a font-weight string/number in the output range cannot be parsed to a valid weight, a TypeError is thrown listing the accepted formats.
Solutions
- Use numeric weights 1–1000 (e.g. '400', '700') or exactly 'normal'/'bold'.
- Fix out-of-range numbers to be within 1–1000.
- Interpolate the number 400→700 and apply with fontWeight: String(w).
Example fix
// before interpolate(f, [0,1], ['thin','semibold']) // after interpolate(f, [0,1], ['100','600'])
Defensive patterns
Strategy: validation
Validate before calling
const isValidWeight = (v: string | number) => v === 'normal' || v === 'bold' || (typeof v === 'string' && /^\d+$/.test(v) && +v >= 1 && +v <= 1000) || (typeof v === 'number' && v >= 1 && v <= 1000);
Type guard
const isFontWeight = (v: unknown): v is number | 'normal' | 'bold' => v === 'normal' || v === 'bold' || (typeof v === 'number' && v >= 1 && v <= 1000);
Try / catch
try {
interpolate(f, r, weights, {outputType: 'font-weight'});
} catch (e) {
if (e instanceof TypeError) useNumericWeights();
} Prevention
- Use numeric strings ('400','700') or 'normal'/'bold' only.
- Avoid CSS keyword weights like 'semibold' (not valid CSS font-weight).
- Never pass px/rem values into font-weight interpolation.
When it happens
Trigger: Output range containing strings like '900px', 'thin', '1000.5', or numbers < 1 or > 1000 where font-weight values are expected.
Common situations: Typo'd weights ('500px'); using named weights like 'semibold' which aren't CSS-standard; passing rem/px-styled values into font-weight interpolation.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- bezier x values must be in [0, 1] range
- Cannot interpolate " " as because it is a rotate value
- Cannot interpolate " " as because it is a transform-origin…
- A "duration" of a spring is NaN, which it must not be
- A "duration" of a spring must be a "number" but is
AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-18).
Data as JSON: /api/errors/ddf047df3403b262.
Report an issue: GitHub.
Appendix: source
Thrown at packages/core/src/interpolate.ts:976
if (lowerCaseOutput === 'normal') {
return 400;
}
if (lowerCaseOutput === 'bold') {
return 700;
}
}
const match =
typeof output === 'string' ? cssNumberRegex.exec(output) : null;
const value =
typeof output === 'number'
? output
: match !== null && match[2] === undefined
? Number(match[1])
: Number.NaN;
if (!Number.isFinite(value) || value < 1 || value > 1000) {
throw new TypeError(
`Cannot interpolate font weight "${output}". Expected "normal", "bold", or a number between 1 and 1000`,
);
}
return value;
});
return interpolateNumber({
input,
inputRange,
outputRange: normalizedOutputRange,
options,
});
};
const interpolateDiscreteString = ({
input,
inputRange,View on GitHub (pinned to 46a3a6bf13)