Skip to content

Cannot throw/return a 404 from middleware #13659

@bravo-kernel

Description

@bravo-kernel

I'm using React Router as a...

framework

Reproduction

// in a middleware
return data("Nice Not Found", {
    status: 404
})

Should bubble up to the ErrorBoundary, if I understood correctly, but does not.

Details explained by @brophdawg11 in this Discord chat https://discordapp.com/channels/770287896669978684/770287896669978687/1375107748794208337

System Info

- Windows
- "node": "22.13.0"
- "react-router": "^7.6.0",

Used Package Manager

npm

Expected Behavior

See "Nice Not Found" with theming etc.

Actual Behavior

Shows a plain white page with only the text "Nice Not Found"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions