withastro/astro · warning

The font file ${JSON.stringify(path)} referenced in your con

Error message

The font file ${JSON.stringify(path)} referenced in your config has been deleted. Restore the file or remove this font from your configuration if it is no longer needed.

What it means

In dev, the fonts vite-plugin watches the local font files your config references. When one is deleted or renamed on disk (chokidar 'unlink' event) and its path matches a configured absolute font URL, Astro warns that the file referenced in your config has been deleted and asks you to restore it or remove the font from configuration. The cache is intentionally not purged, so restoring the file lets the dev server resume using it.

Source

Thrown at packages/astro/src/assets/fonts/vite-plugin-fonts.ts:269

				}
				const localPaths = [...fontFileById.values()]
					.filter(({ url }) => isAbsolute(url))
					.map((v) => v.url);
				if (localPaths.includes(path)) {
					logger.info('assets', 'Font file updated');
					server.restart();
				}
			});
			// We do not purge the cache in case the user wants to re-use the file later on
			server.watcher.on('unlink', (path) => {
				if (!fontFileById) {
					return;
				}
				const localPaths = [...fontFileById.values()]
					.filter(({ url }) => isAbsolute(url))
					.map((v) => v.url);
				if (localPaths.includes(path)) {
					logger.warn(
						'assets',
						`The font file ${JSON.stringify(path)} referenced in your config has been deleted. Restore the file or remove this font from your configuration if it is no longer needed.`,
					);
				}
			});

			server.middlewares.use(assetsDir, (req, res, next) =>
				fontFileMiddleware({
					url: req.url,
					response: resToMinimalResponse(res),
					next,
					fontFetcher,
					fontFileById,
					fontTypeExtractor,
					logger,
				}),
			);
		},

View on GitHub (pinned to 52e6c34790)

Solutions

  1. Restore the file if it should exist: `git checkout -- src/assets/fonts/<file>`
  2. If the font is gone for good, remove its family/entry from the `fonts` config
  3. Restart `astro dev` if font styles or preloads look stale after the change
Defensive patterns

Strategy: validation

Validate before calling

// Check config-referenced local fonts at startup
import { existsSync } from 'node:fs';
const fontSrcs = ['src/assets/fonts/brand.woff2'];
const missing = fontSrcs.filter((p) => !existsSync(p));
if (missing.length) throw new Error(`font files missing on disk: ${missing.join(', ')}`);

Prevention

When it happens

Trigger: Deleting, moving, or renaming a local font file (src/assets/fonts/*.woff2) while `astro dev` is running; switching git branches where the font file exists on one branch but not the other.

Common situations: Branch switches removing untracked font files; asset-folder refactors while the dev server stays open; cleanup scripts pruning 'unused' files that are actually referenced by config.

Related errors


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