{"record":{"id":"cc4d510766e9c232","repo":"withastro/astro","slug":"the-font-file-json-stringify-path-referenced-i","errorCode":null,"errorMessage":"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.","messagePattern":"The font file (.+?) referenced in your config has been deleted\\. Restore the file or remove this font from your configuration if it is no longer needed\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/astro/src/assets/fonts/vite-plugin-fonts.ts","lineNumber":269,"sourceCode":"\t\t\t\t}\n\t\t\t\tconst localPaths = [...fontFileById.values()]\n\t\t\t\t\t.filter(({ url }) => isAbsolute(url))\n\t\t\t\t\t.map((v) => v.url);\n\t\t\t\tif (localPaths.includes(path)) {\n\t\t\t\t\tlogger.info('assets', 'Font file updated');\n\t\t\t\t\tserver.restart();\n\t\t\t\t}\n\t\t\t});\n\t\t\t// We do not purge the cache in case the user wants to re-use the file later on\n\t\t\tserver.watcher.on('unlink', (path) => {\n\t\t\t\tif (!fontFileById) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst localPaths = [...fontFileById.values()]\n\t\t\t\t\t.filter(({ url }) => isAbsolute(url))\n\t\t\t\t\t.map((v) => v.url);\n\t\t\t\tif (localPaths.includes(path)) {\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t'assets',\n\t\t\t\t\t\t`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.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tserver.middlewares.use(assetsDir, (req, res, next) =>\n\t\t\t\tfontFileMiddleware({\n\t\t\t\t\turl: req.url,\n\t\t\t\t\tresponse: resToMinimalResponse(res),\n\t\t\t\t\tnext,\n\t\t\t\t\tfontFetcher,\n\t\t\t\t\tfontFileById,\n\t\t\t\t\tfontTypeExtractor,\n\t\t\t\t\tlogger,\n\t\t\t\t}),\n\t\t\t);\n\t\t},","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/astro/src/assets/fonts/vite-plugin-fonts.ts#L251-L287","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Restore the file if it should exist: `git checkout -- src/assets/fonts/<file>`","If the font is gone for good, remove its family/entry from the `fonts` config","Restart `astro dev` if font styles or preloads look stale after the change"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check config-referenced local fonts at startup\nimport { existsSync } from 'node:fs';\nconst fontSrcs = ['src/assets/fonts/brand.woff2'];\nconst missing = fontSrcs.filter((p) => !existsSync(p));\nif (missing.length) throw new Error(`font files missing on disk: ${missing.join(', ')}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit font files to git so branch switches can't delete them","Avoid branch-dependent font paths in the fonts config","When reorganizing assets, update the config in the same commit and restart `astro dev`"],"tags":["fonts","dev-server","file-watching","experimental-assets"],"backgroundTag":"missing-font-file","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}