{"record":{"id":"14100a0e5f9e0456","repo":"sveltejs/kit","slug":"id-did-not-match-any-route-note-that-routes","errorCode":null,"errorMessage":"'${id}' did not match any route (note that routes without a `+page` have no code to preload). It does match as a pathname — use `match(...)` from `$app/paths` to convert a pathname into a route ID","messagePattern":"'(.+?)' did not match any route \\(note that routes without a `\\+page` have no code to preload\\)\\. It does match as a pathname — use `match\\(\\.\\.\\.\\)` from `\\$app/paths` to convert a pathname into a route ID","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/client/client.js","lineNumber":2896,"sourceCode":"\tif (!route) {\n\t\tif (DEV) {\n\t\t\t// warn rather than throw, since under client routing an endpoint-only route id is\n\t\t\t// indistinguishable from a typo — the client manifest only contains routes with a `+page`\n\t\t\tlet message = `'${id}' did not match any route`;\n\n\t\t\tif (__SVELTEKIT_CLIENT_ROUTING__) {\n\t\t\t\tmessage += ` (note that routes without a \\`+page\\` have no code to preload)`;\n\n\t\t\t\t// the most common migration mistake is passing a pathname, which used to work\n\t\t\t\tconst candidates = [id];\n\t\t\t\tif (base && id.startsWith(base)) candidates.push(id.slice(base.length) || '/');\n\n\t\t\t\tif (candidates.some((path) => routes.some((r) => r.exec(path)))) {\n\t\t\t\t\tmessage += `. It does match as a pathname — use \\`match(...)\\` from \\`$app/paths\\` to convert a pathname into a route ID`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.warn(message);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tawait load_route_nodes(route);\n}\n\n/**\n * Programmatically create a new history entry with the given `page.state`. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing).\n *\n * @deprecated Use `goto(url, { state, shallow: true })` instead.\n * @param {string | URL} url\n * @param {App.PageState} state\n * @returns {Promise<void>}\n */\nexport async function pushState(url, state) {\n\tif (DEV && !warned_on_push_state) {","sourceCodeStart":2878,"sourceCodeEnd":2914,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/client/client.js#L2878-L2914","documentation":"The given string did not match any route ID in the app's manifest, so there is nothing to preload. SvelteKit checks whether the string matches as a URL pathname and, if so, appends guidance: route IDs are module paths like `/about/+page@svelte`, not plain pathnames — use `match()` from `$app/paths` to convert a pathname into a route ID first.","triggerScenarios":"Calling `preloadData('/about')` or `preloadCode('/about')` with a raw pathname that corresponds to a page but is not a route ID, in DEV; the lookup in packages/kit/src/runtime/client/client.js fails and builds the message, appending the `match(...)` hint when pathname candidates exist.","commonSituations":"Confusing `goto()` URL semantics with `preloadData()` route-ID semantics; hard-coded strings like `'/blog/[slug]'` that don't match manifest IDs (e.g. need `+page@` suffixes or exact node paths).","solutions":["Convert the pathname: `const id = match('/about')?.id` from `$app/paths`, then `preloadData(id)`","Use `resolveRoute()` or inspect `import.meta.glob`/route manifest to get the correct route ID including `+page@` suffixes","If the string was meant as a URL to navigate, use `goto()` instead of `preloadData()`"],"exampleFix":"// before\nawait preloadData('/about');\n// after\nimport { match } from '$app/paths';\nconst id = match('/about');\nif (id) await preloadData(id);","handlingStrategy":"validation","validationCode":"import { match } from '$app/paths';\nconst id = match(pathname);\nif (id) await preloadData(id);","typeGuard":"function isKnownRouteId(id) { return typeof match === 'function' && match(idToPath(id)) != null; }","tryCatchPattern":"const id = match(pathname);\nif (!id) { console.warn('no route matches', pathname); return; }\nawait preloadData(id);","preventionTips":["Always convert pathnames to route IDs with `match()` from `$app/paths` before preloading","Account for `+page@` layout-breakout suffixes in route IDs","If you have a URL, prefer `goto()` over preload APIs"],"tags":["preloading","routing","client-side"],"backgroundTag":"invalid-route-id-preload","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}