remotion-dev/remotion · error · Error
The font ${meta.fontFamily} does not have a weight ${weight
Error message
The font ${meta.fontFamily} does not have a weight ${weight} in style ${style} What it means
Thrown by @remotion/google-fonts `loadFonts` when a requested `weight` is not present under the chosen style in the font metadata. The weight list is resolved either from `options.weights` or defaults to all keys of `meta.fonts[style]`; any entry that is not a key triggers this error. (Note: the message contains a doubled space typo, which is preserved in the source.)
Source
Thrown at packages/google-fonts/src/base.ts:119
const styles = style ? [style] : Object.keys(meta.fonts);
let fontsLoaded = 0;
for (const style of styles) {
// Don't load fonts on server
if (typeof FontFace === 'undefined') {
continue;
}
if (!meta.fonts[style]) {
throw new Error(
`The font ${meta.fontFamily} does not have a style ${style}`,
);
}
const weights = options?.weights ?? Object.keys(meta.fonts[style]);
for (const weight of weights) {
if (!meta.fonts[style][weight]) {
throw new Error(
`The font ${meta.fontFamily} does not have a weight ${weight} in style ${style}`,
);
}
const requestedSubsets: string[] =
options?.subsets ?? Object.keys(meta.fonts[style][weight]);
const availableSubsetKeys = Object.keys(meta.fonts[style][weight]);
const subsets = [
...new Set(
requestedSubsets.flatMap((requestedSubset) =>
resolveFontSubsetKeys({
availableSubsetKeys,
metaSubsets: meta.subsets,
requestedSubset,
}),
),
),
];
for (const subset of subsets) {View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Check `Object.keys(meta.fonts[style])` for the available weights and only request those.
- Pass weights as strings (e.g. '700'), matching the metadata key format.
- Omit `options.weights` to load all weights the family actually provides.
Example fix
// before
loadFonts(meta, 'normal', {weights: ['900'], subsets: ['latin']});
// after
const available = Object.keys(meta.fonts['normal']);
loadFonts(meta, 'normal', {weights: available, subsets: ['latin']}); Defensive patterns
Strategy: validation
Validate before calling
function availableWeights(meta: FontInfo, style: string): string[] {
return Object.keys(meta.fonts[style] ?? {});
}
const wanted = ['400', '700'].filter((w) => availableWeights(meta, 'normal').includes(w));
loadFonts(meta, 'normal', {weights: wanted, subsets: ['latin']}); Type guard
function weightExists(meta: FontInfo, style: string, weight: string): boolean {
return Object.prototype.hasOwnProperty.call(meta.fonts[style] ?? {}, weight);
} Prevention
- Pass weights as strings matching the metadata keys (e.g. '700', not 700).
- Filter requested weights against Object.keys(meta.fonts[style]) before calling loadFonts.
- Omit weights to load every weight the family actually ships.
When it happens
Trigger: Calling `loadFonts(meta, 'normal', {weights: ['900'], subsets: ['latin']})` for a family that only offers weights 400 and 700; passing a weight as a number instead of a string (the keys are strings like '400').
Common situations: Assuming a weight exists because it does for a different font; copy-pasting weights from another family's example; mixing numeric and string weight values.
Related errors
- The font ${meta.fontFamily} does not have a style ${style}
- weight: ${weight} subset: ${subset} is not available for '${
- Expected a URL string but received ${url === undefined ? 'un
- Could not automatically derive font format from extension: $
- loadFont() requires an object as its argument, but received
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/86730fe53cafb43c.
Report an issue: GitHub.