{"record":{"id":"ed98e1d1bbdca9f5","repo":"withastro/astro","slug":"unable-to-find-css-for-routedata-component-thi","errorCode":null,"errorMessage":"Unable to find CSS for ${routeData.component}. This is likely a bug in Astro.","messagePattern":"Unable to find CSS for (.+?)\\. This is likely a bug in Astro\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/astro/src/core/environment/dev-nonrunnable.ts","lineNumber":163,"sourceCode":"\t\t\t\t\tlatestAstroVersion: manifest.devToolbar.latestAstroVersion,\n\t\t\t\t\tdebugInfo: manifest.devToolbar.debugInfoOutput ?? '',\n\t\t\t\t\tplacement: manifest.devToolbar.placement,\n\t\t\t\t};\n\n\t\t\t\t// Additional data for the dev overlay\n\t\t\t\tconst children = `window.__astro_dev_toolbar__ = ${stringifyForScript(additionalMetadata)}`;\n\t\t\t\tscripts.add({ props: {}, children });\n\t\t\t}\n\n\t\t\tconst { devCSSMap } = await import('virtual:astro:dev-css-all');\n\n\t\t\tconst importer = devCSSMap.get(routeData.component);\n\t\t\tlet css = new Set<ImportedDevStyle>();\n\t\t\tif (importer) {\n\t\t\t\tconst cssModule = await importer();\n\t\t\t\tcss = cssModule.css;\n\t\t\t} else {\n\t\t\t\tgetLogger(manifest).warn(\n\t\t\t\t\t'assets',\n\t\t\t\t\t`Unable to find CSS for ${routeData.component}. This is likely a bug in Astro.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Pass framework CSS in as style tags to be appended to the page.\n\t\t\tfor (const { id, url: src, content } of css) {\n\t\t\t\t// Vite handles HMR for styles injected as scripts\n\t\t\t\tscripts.add({ props: { type: 'module', src }, children: '' });\n\t\t\t\t// But we still want to inject the styles to avoid FOUC. The style tags\n\t\t\t\t// should emulate what Vite injects so further HMR works as expected.\n\t\t\t\tstyles.add({ props: { 'data-vite-dev-id': id }, children: content });\n\t\t\t}\n\n\t\t\treturn { scripts, styles, links };\n\t\t},\n\n\t\tcomponentMetadata() {},","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/astro/src/core/environment/dev-nonrunnable.ts#L145-L181","documentation":"In dev, Astro serves a route's framework styles by looking the component path up in the dev CSS map (virtual module 'virtual:astro:dev-css-all') and importing its CSS module. If the route's component has no entry in that map, no styles can be injected and Astro logs that this is most likely an internal bug rather than a config problem.","triggerScenarios":"routeData.component is absent from devCSSMap — typically a stale Vite module graph after editing astro.config/vite options while the dev server is running, unusual component path aliases, or a genuine Astro regression in the dev-toolbar style-injection path.","commonSituations":"Right after changing build/dev config with the server still running; HMR edge cases after renaming components; brand-new Astro versions where the dev CSS pipeline regressed.","solutions":["Restart the dev server — stale virtual-module state is the usual cause","Delete the Vite cache (node_modules/.vite) and start again","Update Astro to the latest patch release; if it persists, report it at https://astro.build/issues with a minimal reproduction since the message flags an internal bug"],"exampleFix":"# before: warning persists across page reloads\n\n# after\nrm -rf node_modules/.vite\nnpm run dev\n# still failing? update astro (npm install astro@latest) and report the bug","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restart the dev server after changing astro.config or vite config","Clear node_modules/.vite when dev-time asset injection behaves oddly","Keep Astro patched; report reproducible occurrences with a minimal repo"],"tags":["css","dev-server","vite","internal-bug"],"backgroundTag":"internal-framework-bug","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"}