{"record":{"id":"efc6465afc7ce64a","repo":"remotion-dev/remotion","slug":"the-variable-font-meta-fontfamily-does-not-have-a-style","errorCode":null,"errorMessage":"The variable font ${meta.fontFamily} does not have a style ${style}","messagePattern":"The variable font (.+?) does not have a style (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/google-fonts/src/base.ts","lineNumber":270,"sourceCode":"\toptions: FontLoadOptions & {subsets: string[]},\n): {\n\tfontFamily: FontInfo['fontFamily'];\n\taxes: Record<string, {min: number; max: number}>;\n\twaitUntilDone: () => Promise<undefined>;\n} => {\n\tif (!meta.variable) {\n\t\tthrow new Error(`${meta.fontFamily} is not available as a variable font`);\n\t}\n\n\tif (options.subsets.length === 0) {\n\t\tthrow new Error('Pass at least one subset to loadVariableFont()');\n\t}\n\n\tconst fontFacesForStyle = meta.variable.fontFaces.filter(\n\t\t(fontFace) => fontFace.style === style,\n\t);\n\tif (fontFacesForStyle.length === 0) {\n\t\tthrow new Error(\n\t\t\t`The variable font ${meta.fontFamily} does not have a style ${style}`,\n\t\t);\n\t}\n\n\tconst availableSubsetKeys = fontFacesForStyle.map(\n\t\t(fontFace) => fontFace.subset,\n\t);\n\tconst subsets = [\n\t\t...new Set(\n\t\t\toptions.subsets.flatMap((requestedSubset) =>\n\t\t\t\tresolveFontSubsetKeys({\n\t\t\t\t\tavailableSubsetKeys,\n\t\t\t\t\tmetaSubsets: meta.subsets,\n\t\t\t\t\trequestedSubset,\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n\t];","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/google-fonts/src/base.ts#L252-L288","documentation":"Variable fonts expose only the styles their fontFaces define (typically 'normal' and 'italic'). loadVariableFont() filters meta.variable.fontFaces by the requested style and throws this error when no font face matches, meaning the requested style string is not offered by this variable font.","triggerScenarios":"Calling loadVariableFont() with a style value that the font's variable fontFaces do not include, e.g. loadVariableFont(meta, {style: 'italic'}) on a font that only has a 'normal' variable font face, or a typo like 'Normal'.","commonSituations":"Hard-coding style: 'italic' for fonts that ship italic only as static faces; mistyping the style string; copying a working call from one font to another font with fewer variable styles.","solutions":["Use a style that the font defines; inspect meta.variable.fontFaces to see available styles","Use the default style ('normal') which most variable fonts provide","If you need the italic style, load the corresponding static font via its loadFont() instead of the variable loader"],"exampleFix":"// before\nawait loadVariableFont(font, {style: 'italic', subsets: ['latin']});\n// after\nawait loadVariableFont(font, {style: 'normal', subsets: ['latin']});","handlingStrategy":"validation","validationCode":"const styles = new Set(font.meta.variable.fontFaces.map((f) => f.style));\nif (!styles.has(requestedStyle)) {\n  throw new Error(`${font.fontFamily} supports styles: ${[...styles].join(', ')}`);\n}","typeGuard":"function hasStyle(meta: FontMeta, style: string): boolean {\n  return !!meta.variable && meta.variable.fontFaces.some((f) => f.style === style);\n}","tryCatchPattern":"try {\n  await loadVariableFont(font, {style, subsets: ['latin']});\n} catch (e) {\n  if ((e as Error).message.includes('does not have a style')) {\n    await loadVariableFont(font, {style: 'normal', subsets: ['latin']});\n  } else throw e;\n}","preventionTips":["Inspect the font's available styles via metadata before choosing a style","Do not hard-code 'italic'; most variable fonts only define 'normal'","Use the package's generated loadFont()/loadVariableFont wrappers which expose typed style values"],"tags":["fonts","styles","api-misuse"],"backgroundTag":"invalid-enum-value","analyzedSha":"46a3a6bf13ca367376ff18bbb06dae2e87e0d068","analyzedAt":"2026-09-18T00:12:20.256Z","contentChangedAt":"2026-09-18T00:12:20.256Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}