Astro shows “No static path found for requested path” when a URL matches a dynamic route pattern, such as /blog/[slug], but the value in the URL isn’t one of the params that route’s getStaticPaths() returned. In development the page errors; in production it’s simply a 404. The fix is to make sure the value you’re visiting is generated, with the exact same spelling and type.
Key Takeaways
- The URL matched
[slug].astro, butgetStaticPaths()didn’t return that slug.- Most often it’s a typo, a case mismatch, or an id that contains a slash.
- Params must be strings.
{ id: 42 }never matches/products/42/.- The dev error lists the dynamic routes Astro tried, which tells you which file to check.
The full error
The message reads: “A getStaticPaths() route pattern was matched, but no matching static path was found for requested path.” Astro adds the route patterns it considered, for example src/pages/blog/[slug].astro. Start there.
Common causes and fixes
The entry doesn’t exist (or is filtered out)
If you filter drafts in getStaticPaths(), draft posts have no page:
const posts = await getCollection('blog', ({ data }) => !data.draft);
Visiting a draft’s URL then produces this error. Either publish it or remove links to it.
The id isn’t what you think
Content collection ids come from file paths. src/content/blog/2026/launch.md has the id 2026/launch, not launch. Log what you’re returning:
export async function getStaticPaths() {
const posts = await getCollection('blog');
console.log(posts.map((p) => p.id));
return posts.map((post) => ({ params: { slug: post.id }, props: { post } }));
}
Ids with slashes need a rest parameter file name: [...slug].astro, not [slug].astro.
Numbers instead of strings
// Wrong: never matches
return items.map((item) => ({ params: { id: item.id } }));
// Right
return items.map((item) => ({ params: { id: String(item.id) } }));
Case and encoding
/blog/My-Post/ and /blog/my-post/ are different paths. Slugify consistently, and make links use the same function that builds params.
The link is wrong, not the route
Search your templates for the URL. A hard-coded link to an old slug is a common source after renaming a post. Keep old URLs working with redirects in Astro.
Check every generated path
npm run build prints each page it writes. Compare that list with the URL that failed. If you’re paginating, remember [page].astro starts at /1/, while [...page].astro puts page one at the parent path.
The Astro routing guide covers params, rest parameters and pagination in depth, and getStaticPaths() required covers the related error when the function is missing entirely. Astro’s error reference has the canonical description.
FAQ
Why does this only happen in development?
In production a missing static path is served as your 404 page. The dev server shows the error so you notice the broken link.
Can I fall back to rendering unknown paths on demand?
Yes, by making the route on-demand with export const prerender = false and an adapter. Then any value is handled at request time.