withastro/astro · warning

${bold(family.name)} font family cannot be retrieved by the

Error message

${bold(family.name)} font family cannot be retrieved by the provider. Did you mean ${bold(stringMatcher.getClosestMatch(family.name, availableFamilies))}?

What it means

Emitted immediately after 'No data found for font family X' when the provider does serve fonts but none named exactly as configured. Astro fetches the provider's full font list and prints the closest match by string distance — '<name> font family cannot be retrieved by the provider. Did you mean <match>?' — pointing directly at the typo or naming mismatch.

Source

Thrown at packages/astro/src/assets/fonts/core/compute-font-families-assets.ts:84

			// We do not merge the defaults, we only provide defaults as a fallback
			weights: family.weights ?? defaults.weights,
			styles: family.styles ?? defaults.styles,
			subsets: family.subsets ?? defaults.subsets,
			formats: family.formats ?? defaults.formats,
			options: family.options,
		});
		if (_fonts.length === 0) {
			logger.warn(
				'assets',
				`No data found for font family ${bold(family.name)}. Review your configuration`,
			);
			const availableFamilies = await fontResolver.listFonts({ provider: family.provider });
			if (
				availableFamilies &&
				availableFamilies.length > 0 &&
				!availableFamilies.includes(family.name)
			) {
				logger.warn(
					'assets',
					`${bold(family.name)} font family cannot be retrieved by the provider. Did you mean ${bold(stringMatcher.getClosestMatch(family.name, availableFamilies))}?`,
				);
			}
			continue;
		}
		// The data returned by the provider contains original URLs. We proxy them.
		// TODO: dedupe?
		fontAssets.fonts.push(
			...filterAndTransformFontFaces({
				fonts: _fonts,
				family,
			}),
		);

		const result = collectFontAssetsFromFaces({
			fonts: fontAssets.fonts,
			family,

View on GitHub (pinned to 52e6c34790)

Solutions

  1. Rename the family in your config to the exact name quoted after 'Did you mean'
  2. If the suggested name is not what you want, browse the provider catalog for the correct spelling
  3. If the family genuinely only exists under another provider, fix the `provider` field instead of the name

Example fix

// before
fonts: [{ provider: fontProviders.google(), name: 'Inter Display', cssVariable: '--font-sans' }]

// after (name suggested by the warning)
fonts: [{ provider: fontProviders.google(), name: 'Inter', cssVariable: '--font-sans' }]
Defensive patterns

Strategy: validation

Validate before calling

// Optional: preflight names against the provider catalog (google example)
const res = await fetch('https://fonts.googleapis.com/css2?family=Inter&display=swap');
if (!res.ok) throw new Error(`family not served by provider (status ${res.status})`);

Prevention

When it happens

Trigger: The family name is edit-distance-close to a real catalog entry: 'Inter Display' vs 'Inter', wrong casing, a dropped suffix, or a spelling error.

Common situations: Hand-typed family names; copying display names from a provider's marketing page rather than its API catalog; assuming two providers expose the same name.

Related errors


AI-assisted analysis of withastro/astro@52e6c34790 (2026-08-18). Data as JSON: /api/errors/91b57c4b47b5a7ba. Report an issue: GitHub.