remotion-dev/remotion · error · Error

weight: ${weight} subset: ${subset} is not available for '${

Error message

weight: ${weight} subset: ${subset} is not available for '${meta.fontFamily}'

What it means

Thrown by @remotion/google-fonts `loadFonts` when, for a resolved (style, weight, subset) combination, no font URL exists in the metadata. Subsets are expanded through `resolveFontSubsetKeys`, so a requested subset may map to a metadata subset that the chosen weight does not provide; the lookup `meta.fonts[style][weight][subset]` then returns undefined.

Source

Thrown at packages/google-fonts/src/base.ts:143

			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) {
				//  Get font url from meta
				let font = meta.fonts[style]?.[weight]?.[subset];

				//  Check is font available in meta
				if (!font) {
					throw new Error(
						`weight: ${weight} subset: ${subset} is not available for '${meta.fontFamily}'`,
					);
				}

				//  Check is font already loaded
				let fontKey = `${meta.fontFamily}-${style}-${weight}-${subset}`;
				const previousPromise = loadedFonts[fontKey];
				if (previousPromise) {
					promises.push(previousPromise);
					continue;
				}

				const baseLabel = `Fetching ${meta.fontFamily} font ${JSON.stringify({
					style,
					weight,
					subset,
				})}`;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Inspect `Object.keys(meta.fonts[style][weight])` to see which subsets the specific weight provides.
  2. Restrict `subsets` to values present in `meta.subsets` and in the per-weight metadata.
  3. Omit `subsets` to load all subsets available for the requested weights.

Example fix

// before
loadFonts(meta, 'normal', {weights: ['400'], subsets: ['latin-ext', 'cyrillic']});

// after
const validSubsets = Object.keys(meta.fonts['normal']['400']);
loadFonts(meta, 'normal', {weights: ['400'], subsets: validSubsets});
Defensive patterns

Strategy: validation

Validate before calling

function availableSubsets(meta: FontInfo, style: string, weight: string): string[] {
  return Object.keys(meta.fonts[style]?.[weight] ?? {});
}

const subsets = requestedSubsets.filter((s) => availableSubsets(meta, 'normal', '400').includes(s));
loadFonts(meta, 'normal', {weights: ['400'], subsets});

Type guard

function subsetExists(meta: FontInfo, style: string, weight: string, subset: string): boolean {
  return Object.prototype.hasOwnProperty.call(meta.fonts[style]?.[weight] ?? {}, subset);
}

Prevention

When it happens

Trigger: Requesting `{weights: ['400'], subsets: ['latin-ext']}` for a weight that only ships 'latin'; requesting a subset that does not exist for the family at all; passing a subset string with incorrect casing or spelling.

Common situations: Assuming every weight offers every subset; using a subset name from a different font's docs; the family dropped a subset in a newer version of the metadata.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/7312a3238f17e8dc. Report an issue: GitHub.