sveltejs/kit · error
No routes found. If you are using a custom src/routes direct
Error message
No routes found. If you are using a custom src/routes directory, make sure it is specified in your SvelteKit Vite plugin options
What it means
Thrown after walking the routes directory when only the root route exists and it has no leaf page, error, layout, or endpoint file — i.e. no actual routes were discovered. Almost always means the routes directory location is wrong: SvelteKit is scanning the default src/routes while the app keeps its routes elsewhere and the custom directory was never declared in the SvelteKit Vite plugin options.
Source
Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:375
page_options: null // will be filled later
};
}
}
// then handle children
for (const file of files) {
if (file.is_dir) {
walk(depth + 1, path.posix.join(id, file.name), file.name, route);
}
}
};
walk(0, '/', '', null);
if (routes.length === 1) {
const root = routes[0];
if (!root.leaf && !root.error && !root.layout && !root.endpoint) {
throw new Error(
'No routes found. If you are using a custom src/routes directory, make sure it is specified in your SvelteKit Vite plugin options'
);
}
}
} else {
// If there's no routes directory, we'll just create a single empty route. This ensures the root layout and
// error components are included in the manifest, which is needed for subsequent build/dev commands to work
routes.push({
id: '/',
segment: '',
pattern: /^$/,
params: [],
parent: null,
layout: null,
error: null,
leaf: null,
page: null,
endpoint: nullView on GitHub (pinned to 03f1687fe6)
Solutions
- Point SvelteKit at your routes directory, e.g. sveltekit({ routes: 'src/my-routes' }) in vite.config.js
- Move your route files into src/routes
- Create at least one route file such as src/routes/+page.svelte
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:375 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/74660b0848d46dda.
Report an issue: GitHub.