Skip to content

Errors instances returned from loaders should not be sanitized. Only thrown errors should be #14253

@remorses

Description

@remorses

Reproduction

https://stackblitz.com/edit/github-p6swxmao?file=app%2Froutes%2Fhome.tsx

Run in production mode with pnpm build and pnpm start. Error will be shown as Unexpected Server Error

System Info

  System:
    OS: macOS 15.6
    CPU: (10) arm64 Apple M2 Pro
    Memory: 188.14 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.17.1 - ~/.local/share/pnpm/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.9.2 - ~/.local/share/pnpm/npm
    pnpm: 10.14.0 - ~/.local/share/pnpm/pnpm
    bun: 1.2.20 - ~/.bun/bin/bun
  Browsers:
    Chrome: 139.0.7258.154
    Safari: 18.6

Used Package Manager

npm

Expected Behavior

Errors instances returned from loaders should not be sanitized. Only thrown errors should be

Actual Behavior

Loaders returned errors are replaced with Unexpected server error

This should happen only with thrown exceptions, If i return an error in the loader I expect it to remain intact, like Next.js and RSC do

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions