react-router icon indicating copy to clipboard operation
react-router copied to clipboard

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

Open remorses opened this issue 3 months ago • 0 comments

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

remorses avatar Aug 27 '25 14:08 remorses