-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Which project does this relate to?
Router
Describe the bug
I have a parse function for path parameters, which throws a notFound error when the parameters aren't in the required format. For example:
export const Route = createFileRoute('/$id')({
component: Home,
params: {
parse: ({ id }) => {
const parsedId = parseInt(id, 10);
if (Number.isNaN(parsedId)) {
throw notFound();
}
return { id: parsedId };
}
},
notFoundComponent: () => <div>Page not found</div>
})
However, this leads to a 500 error, not the 404 that I'd expect. Is this the correct behaviour or a bug? If it's expected, is there a way to get the 404 in this case?
See full example in this repository. I asked about this in the Discord here and was recommended to create this issue.
Your Example Website or App
https://github.com/matt-thomson/tanstack-validate-not-found/
Steps to Reproduce the Bug or Issue
See above
Expected behavior
I expect to see a 404 error, but instead I get a 500.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.134.9
- OS: Linux
- Browser: Firefox
- Browser Version: 144.0.2
- Bundler: vite
- Bundler Version: 7.1.7
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels