{"record":{"id":"86730fe53cafb43c","repo":"remotion-dev/remotion","slug":"the-font-meta-fontfamily-does-not-have-a-weigh","errorCode":null,"errorMessage":"The font ${meta.fontFamily} does not  have a weight ${weight} in style ${style}","messagePattern":"The font (.+?) does not  have a weight (.+?) in style (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/google-fonts/src/base.ts","lineNumber":119,"sourceCode":"\tconst styles = style ? [style] : Object.keys(meta.fonts);\n\n\tlet fontsLoaded = 0;\n\n\tfor (const style of styles) {\n\t\t// Don't load fonts on server\n\t\tif (typeof FontFace === 'undefined') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!meta.fonts[style]) {\n\t\t\tthrow new Error(\n\t\t\t\t`The font ${meta.fontFamily} does not have a style ${style}`,\n\t\t\t);\n\t\t}\n\t\tconst weights = options?.weights ?? Object.keys(meta.fonts[style]);\n\t\tfor (const weight of weights) {\n\t\t\tif (!meta.fonts[style][weight]) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`The font ${meta.fontFamily} does not  have a weight ${weight} in style ${style}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst requestedSubsets: string[] =\n\t\t\t\toptions?.subsets ?? Object.keys(meta.fonts[style][weight]);\n\t\t\tconst availableSubsetKeys = Object.keys(meta.fonts[style][weight]);\n\t\t\tconst subsets = [\n\t\t\t\t...new Set(\n\t\t\t\t\trequestedSubsets.flatMap((requestedSubset) =>\n\t\t\t\t\t\tresolveFontSubsetKeys({\n\t\t\t\t\t\t\tavailableSubsetKeys,\n\t\t\t\t\t\t\tmetaSubsets: meta.subsets,\n\t\t\t\t\t\t\trequestedSubset,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t];\n\t\t\tfor (const subset of subsets) {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/google-fonts/src/base.ts#L101-L137","documentation":"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.)","triggerScenarios":"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').","commonSituations":"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.","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."],"exampleFix":"// before\nloadFonts(meta, 'normal', {weights: ['900'], subsets: ['latin']});\n\n// after\nconst available = Object.keys(meta.fonts['normal']);\nloadFonts(meta, 'normal', {weights: available, subsets: ['latin']});","handlingStrategy":"validation","validationCode":"function availableWeights(meta: FontInfo, style: string): string[] {\n  return Object.keys(meta.fonts[style] ?? {});\n}\n\nconst wanted = ['400', '700'].filter((w) => availableWeights(meta, 'normal').includes(w));\nloadFonts(meta, 'normal', {weights: wanted, subsets: ['latin']});","typeGuard":"function weightExists(meta: FontInfo, style: string, weight: string): boolean {\n  return Object.prototype.hasOwnProperty.call(meta.fonts[style] ?? {}, weight);\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["google-fonts","validation","fonts"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}