{"record":{"id":"9204228c8347f673","repo":"remotion-dev/remotion","slug":"loading-google-fonts-without-specifying-weights-an","errorCode":null,"errorMessage":"Loading Google Fonts without specifying weights and subsets is not supported in Remotion v5. Please specify the weights and subsets you need.","messagePattern":"Loading Google Fonts without specifying weights and subsets is not supported in Remotion v5\\. Please specify the weights and subsets you need\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/google-fonts/src/base.ts","lineNumber":95,"sourceCode":"\t\t? V5Options\n\t\t: V4Options,\n): {\n\tfontFamily: FontInfo['fontFamily'];\n\tfonts: FontInfo['fonts'];\n\tunicodeRanges: FontInfo['unicodeRanges'];\n\twaitUntilDone: () => Promise<undefined>;\n} => {\n\tconst weightsAndSubsetsAreSpecified =\n\t\tArray.isArray(options?.weights) &&\n\t\tArray.isArray(options?.subsets) &&\n\t\toptions.weights.length > 0 &&\n\t\toptions.subsets.length > 0;\n\n\tif (\n\t\tNoReactInternals.ENABLE_V5_BREAKING_CHANGES &&\n\t\t!weightsAndSubsetsAreSpecified\n\t) {\n\t\tthrow new Error(\n\t\t\t'Loading Google Fonts without specifying weights and subsets is not supported in Remotion v5. Please specify the weights and subsets you need.',\n\t\t);\n\t}\n\n\tconst promises: Promise<void>[] = [];\n\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}`,","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/google-fonts/src/base.ts#L77-L113","documentation":"Thrown by @remotion/google-fonts `loadFonts` when running under Remotion v5 breaking-changes mode and the caller did not specify both `weights` and `subsets` as non-empty arrays. Remotion v5 removed the implicit 'load everything' behavior of v4 to avoid downloading unused font files; you must now declare exactly which weights and subsets you need.","triggerScenarios":"Calling `loadFonts(meta, 'normal', {})`, `loadFonts(meta, 'normal', {weights: ['400']})` (subsets missing), or any v4-style call that omits both arrays. The guard checks `ENABLE_V5_BREAKING_CHANGES` plus that both arrays exist and have length > 0.","commonSituations":"Upgrading a project from Remotion v4 to v5 without updating existing `loadFonts`/`getFont` calls; copy-pasting a v4 example; the auto-generated font loader for a font family that was created before v5.","solutions":["Add explicit `weights` and `subsets` arrays to the options, e.g. `loadFonts(meta, 'normal', {weights: ['400','700'], subsets: ['latin']})`.","Consult the font's metadata (or the @remotion/google-fonts docs page for that family) to find the available weights and subsets.","If you cannot move to v5 yet, keep the v4 behavior by ensuring `ENABLE_V5_BREAKING_CHANGES` is not enabled (but migrating is recommended)."],"exampleFix":"// before\nconst {fontFamily} = loadFonts(meta, 'normal', {});\n\n// after\nconst {fontFamily} = loadFonts(meta, 'normal', {\n  weights: ['400', '700'],\n  subsets: ['latin'],\n});","handlingStrategy":"validation","validationCode":"function assertFontOptions(options: {weights?: string[]; subsets?: string[]}) {\n  if (!options.weights?.length || !options.subsets?.length) {\n    throw new Error('In Remotion v5 you must pass non-empty weights and subsets arrays.');\n  }\n}\n\nassertFontOptions(opts);\nloadFonts(meta, 'normal', opts);","typeGuard":"function hasV5FontOptions(options: unknown): options is {weights: string[]; subsets: string[]} {\n  return (\n    !!options &&\n    Array.isArray((options as any).weights) && (options as any).weights.length > 0 &&\n    Array.isArray((options as any).subsets) && (options as any).subsets.length > 0\n  );\n}","tryCatchPattern":null,"preventionTips":["After upgrading to Remotion v5, audit every loadFonts/getFont call and add weights + subsets.","Copy the exact weights and subsets from the font's @remotion/google-fonts docs page.","Write a unit test that loads each font you use with explicit weights/subsets to catch regressions."],"tags":["google-fonts","v5","breaking-change","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}