{"record":{"id":"82ba20d1694a72ba","repo":"withastro/astro","slug":"unable-to-find-css-for-routedata-component-thi-82ba20","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/vite-plugin-app/environment.ts","lineNumber":221,"sourceCode":"\t\t\t\t\t\t});\n\t\t\t\t\t} else if (script.stage === 'page' && isPage(filePath, settings)) {\n\t\t\t\t\t\tscripts.add({\n\t\t\t\t\t\t\tprops: { type: 'module', src: `/@id/${PAGE_SCRIPT_ID}` },\n\t\t\t\t\t\t\tchildren: '',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\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\tconst links = new Set<SSRElement>();\n\n\t\t\tconst styles = new Set<SSRElement>();\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 };","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/astro/src/vite-plugin-app/environment.ts#L203-L239","documentation":"In the dev server's app environment, per-route framework styles are resolved by looking up the route component inside the virtual module virtual:astro:dev-css-all and importing its css collection. If the dev-CSS map has no entry for that component, Astro logs this 'assets' warning — self-described as likely an Astro bug — and renders the page with an empty style set, so framework CSS is missing in dev.","triggerScenarios":"Running `astro dev` when the generated dev-css map is stale or incomplete relative to the route graph: after adding/removing a framework island, renaming pages, integration-injected routes, or an Astro version regression that fails to populate the virtual module.","commonSituations":"Styles present in `astro build` output but missing in dev; appears right after upgrading Astro or a framework integration; monorepos with custom route-injecting integrations whose components never get registered in the map.","solutions":["Restart the dev server so virtual:astro:dev-css-all regenerates","Delete cache directories (node_modules/.astro and node_modules/.vite) and start dev again","Verify no custom integration injects routes in a way that bypasses the dev-CSS plugin","If it reproduces from a clean install, open an Astro issue with a minimal repro — the message itself says it is likely a bug"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restart `astro dev` after adding/removing framework integrations or renaming route files","Clear node_modules/.vite and node_modules/.astro whenever dev styles drift from build output","Compare against `astro build` output to confirm the gap is dev-only before debugging further","Pin a known-good Astro version and report reproducible cases upstream (the message says it is a bug)"],"tags":["astro","dev-server","css","virtual-module","styles-missing"],"backgroundTag":"asset-resolution-failure","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"}