SvelteKit "Not found: /path" during prerendering in CI
During prerendering, SvelteKit crawls links from each page. If a link points at a route that returns 404, the build fails by default and reports which page linked to the missing path.
What this error means
svelte-kit build fails with "404 /missing (linked from /home)" or "Not found: /missing" during the prerender pass. The dev server tolerated the broken link.
> 404 /blog/old-post (linked from /blog)
Error: Not found: /blog/old-post
at file:///app/node_modules/@sveltejs/kit/src/core/postbuild/prerender.jsCommon causes
A link points to a route that does not exist
A hardcoded or stale href references a path with no matching route, so the crawler hits a 404.
A dynamic page is not in the prerender entries
A dynamic route is linked but not enumerated, so the crawler cannot find a prerendered file for it.
How to fix it
Fix or remove the broken link
- Read the "linked from" page in the error to find the bad
href. - Point it at a real route or remove the dead link.
- Re-run the build so the crawler passes.
<!-- correct the href to an existing route -->
<a href="/blog/current-post">Read more</a>Handle missing pages without failing the build
If some links are intentionally external or optional, configure prerender to warn instead of error, or add explicit entries.
// svelte.config.js
kit: { prerender: { handleHttpError: 'warn' } }How to prevent it
- Keep internal links pointing at real routes.
- Add dynamic routes to prerender entries when they are linked.
- Use
handleHttpError: 'warn'only for genuinely optional links.