“Astro can’t render the route.” means Astro matched a URL to a route but found nothing behind it. The message: “Astro cannot find any content to render for this route. There is no file or redirect associated with this route.” It almost always comes from a stale dev server after you renamed, moved or deleted a page. Restart npm run dev; if it persists, check the route actually maps to a file, a redirect, or a route an integration injects.
Key Takeaways
- The usual cause is a page renamed or deleted while the dev server was running. Restart it first.
- Every route needs a page file in
src/pages/, an entry inredirects, or an injected route.- Clear
node_modules/.viteif a restart doesn’t help.- Astro 7 still lists this error, but a route with nothing behind it more often ends in a 404 now.
Fix 1: restart the dev server
Astro’s error hint says it directly: “If you expect to find a route here, this may be an Astro bug. Please file an issue/restart the dev server.” The dev server keeps a route table in memory. Renaming src/pages/about.astro to src/pages/about/index.astro, or switching branches with different pages, can leave a route pointing at a file that no longer exists.
# Terminal: stop with Ctrl+C, then
npm run dev
Fix 2: clear stale caches
If restarting doesn’t help, remove Vite’s dependency cache and Astro’s generated files, then start again:
# Terminal
rm -rf node_modules/.vite .astro
npm run dev
Both are regenerated on startup. This also helps after upgrading Astro or an integration.
Fix 3: check the route has a source
Every URL Astro serves comes from one of three places. Confirm the one you expect exists:
- A page file.
/pricing/needssrc/pages/pricing.astro,src/pages/pricing/index.astro, or a.md/.mdxpage. Dynamic routes likesrc/pages/blog/[slug].astromust return that slug fromgetStaticPaths()when prerendered. - A redirect. Entries in the
redirectsconfig create routes with no file:
// astro.config.mjs
import { defineConfig } from 'astro/config';
export default defineConfig({
redirects: {
'/old-pricing': '/pricing/',
'/blog/[...slug]': '/articles/[...slug]',
},
});
A redirect whose destination doesn’t exist leaves visitors on a dead route. The Astro redirects tip covers the rules for dynamic redirects.
- An injected route. Integrations such as sitemap, Starlight or a CMS can add routes with
injectRoute(). If you removed an integration’s files but left it inintegrations, or the other way round, its routes can break. Checkastro.config.mjsagainstpackage.json.
Fix 4: look for conflicting files
Two files claiming the same URL, such as src/pages/about.astro and src/pages/about.md, or a static and a dynamic route that overlap, confuse the route table. Run a build to see Astro’s route list and any warnings:
# Terminal
npm run build
The prerender route conflict fix explains how Astro prioritises overlapping routes, and the routing guide covers file-based routing end to end. Our pages and routing docs show the page layout used in Komal Astro themes, and the official routing docs list the priority order.
If it still fails after a clean restart with a real file behind it, run npx astro info and open an issue on the Astro GitHub repository with a minimal reproduction.
FAQ
Why does Astro say it can’t render a route that exists?
The dev server is usually holding a stale route table from before you moved or renamed the file. Restart it, and clear node_modules/.vite if needed.
Does this error happen in production builds?
Rarely. It’s mostly a dev-server problem. In a build, routes are computed fresh from your files, so a missing page shows up as a 404 rather than this error.
Can a redirect cause “Astro can’t render the route”?
A redirect defines a route without a file. If its destination is wrong or the redirect was removed while the server ran, the route can end up with nothing to render. Check the redirects config and restart.