Skip to content

Catch block in middleware function never catches anythingΒ #14023

@rossipedia

Description

@rossipedia

Reproduction

https://github.com/rossipedia/rr-middleware-catch
https://stackblitz.com/~/rossipedia/rr-middleware-catch

  1. Start this app:

    npm install
    npm run dev
  2. Make a request to http://localhost:5173

Per the docs, you should see a message:

Route error: error

in the terminal where you ran npm run dev. However, that message is not present, leading to the conclusion that the catch block in the middleware function is never executed.

System Info

System:
    OS: macOS 15.5
    CPU: (16) arm64 Apple M4 Max
    Memory: 9.08 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.4.1 - ~/.local/state/fnm_multishells/35301_1752789017672/bin/node
    Yarn: 1.22.22 - ~/.local/state/fnm_multishells/35301_1752789017672/bin/yarn
    npm: 11.4.2 - ~/src/rr/rr-middleware-catch/node_modules/.bin/npm
    pnpm: 10.12.1 - ~/.local/state/fnm_multishells/35301_1752789017672/bin/pnpm
    bun: 1.2.18 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 138.0.7204.101
    Safari: 18.5
  npmPackages:
    @react-router/dev: ^7.7.0 => 7.7.0 
    @react-router/fs-routes: ^7.7.0 => 7.7.0 
    @react-router/node: ^7.7.0 => 7.7.0 
    @react-router/serve: ^7.7.0 => 7.7.0 
    react-router: ^7.7.0 => 7.7.0 
    vite: ^6.3.5 => 6.3.5

Used Package Manager

npm

Expected Behavior

I should see the output from the middleware catch block

Actual Behavior

I do not see the output from the middleware catch block

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions