`Error: Route could not be found for ...` even though `_fallback.svelte` is present.
See original GitHub issuebug description
I’ve just updated from 2.7.3 to 2.9.0 and now I’m getting this;
Uncaught (in promise) Error: Route could not be found for "parent/12345/children/".
at urlToRoute (urlToRoute.js:24)
at runHooksBeforeUrlChange (navigator.js:109)
at History.history.<computed> [as pushState] (navigator.js:52)
at goto (helpers.js:313)
at HTMLDivElement.click_handler (Item.svelte:39)
This where a _fallback.svelte should be loading, and in 2.7.3 it is.
My folder structure is pages/parent/[id]/_fallback.svelte
The URL giving the error is /parent/12345/children/1234/children
I would expect for it to load _fallback.svelte and then store the rest of the path in $leftover.
The earliest version that I experience this problem is the jump from 2.7.3 to 2.8.0:
https://github.com/roxiness/routify/compare/v2.7.6...v2.8.0
I downgraded back to 2.7.3 and it works as normal. I’ve checked the changelog and can’t see anything that looks like it’s related, so I assume this is not a deliberate change.
It seems there are some changes to runtime/helps.js::resolvePath in 2.8.0, so I suspect it has something to do with that.
version Latest correctly working version: 2.7.3 Earliest broken version: 2.8.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (7 by maintainers)

Top Related StackOverflow Question
Thanks @jamalmoir
I assume this is the culprit https://github.com/roxiness/routify/commit/3a695160e70ee2731c751b6349bed5c9130ac3f9
Since 2.8.0 Routify’s
beforeUrlChangeprovides info on the incoming route, which in your case breaks as you navigate to a non-existing route.So the question is, should
_fallback.sveltebe considered a route or shouldbeforeUrlChangereturn null for non-resolved URLs.Great, @reddec.
@jamalmoir does this patch fix the issue for you?