Next.js Discord

Discord Forum

Why is the error for a parallel route not "catching" the error?

Unanswered
Australian Freshwater Crocodile posted this in #help-forum
Open in Discord
Australian Freshwater CrocodileOP
Im really confused with slots and error boundaries. I have destiled my use case to this simple example: Why is the error boundary not being shown, and instead the whole application crashes?


// demo/@slot/page.tsx
export default function Page () { throw new Error() }

// demo/@slot/error.tsx
export default function Page () { return <h1>Error!!!</h1> }

// demo/layout.tsx
export default function Page({ slot }) { return <>{slot}</> }


results in

Unhandled Runtime Error
Error: An error occurred in the Server Components render but no message was provided

Source
app/test/[testId]/@slot/page.tsx (1:40) @ Page

> 1 | export default function Page () { throw new Error() }
    |                                        ^


I see the same issue with notFound, and using a not-found.tsx.

0 Replies