withastro/astro · warning
Unable to find CSS for ${routeData.component}. This is likel
Error message
Unable to find CSS for ${routeData.component}. This is likely a bug in Astro. What it means
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.
Source
Thrown at packages/astro/src/vite-plugin-app/environment.ts:221
});
} else if (script.stage === 'page' && isPage(filePath, settings)) {
scripts.add({
props: { type: 'module', src: `/@id/${PAGE_SCRIPT_ID}` },
children: '',
});
}
}
}
const { devCSSMap } = await import('virtual:astro:dev-css-all');
const importer = devCSSMap.get(routeData.component);
let css = new Set<ImportedDevStyle>();
if (importer) {
const cssModule = await importer();
css = cssModule.css;
} else {
getLogger(manifest).warn(
'assets',
`Unable to find CSS for ${routeData.component}. This is likely a bug in Astro.`,
);
}
// Pass framework CSS in as style tags to be appended to the page.
const links = new Set<SSRElement>();
const styles = new Set<SSRElement>();
for (const { id, url: src, content } of css) {
// Vite handles HMR for styles injected as scripts
scripts.add({ props: { type: 'module', src }, children: '' });
// But we still want to inject the styles to avoid FOUC. The style tags
// should emulate what Vite injects so further HMR works as expected.
styles.add({ props: { 'data-vite-dev-id': id }, children: content });
}
return { scripts, styles, links };View on GitHub (pinned to 52e6c34790)
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
Defensive patterns
Strategy: retry
Prevention
- 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)
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Server address unavailable, this should not happen. Open an
- Unable to find CSS for ${routeData.component}. This is likel
- You must import your Tailwind stylesheet, e.g. in a shared l
- ⚠️ Astro expected an SVG for "${transform.src}" but the sou
- ⚠️ Astro could not optimize image "${transform.src}". Sharp
AI-assisted analysis of withastro/astro@52e6c34790 (2026-08-18).
Data as JSON: /api/errors/82ba20d1694a72ba.
Report an issue: GitHub.