Open
Description
Reproduction
Unfortunately, I can't reproduce it but can see it affecting users in production based on Sentry's reports. The first instances of the error perfectly match the day we enabled the following feature flags
unstable_optimizeDeps
v3_fetcherPersist
v3_throwAbortReason
v3_relativeSplatPath
v3_lazyRouteDiscovery
v3_routeConfig
System Info
System:
OS: macOS 15.2
CPU: (8) arm64 Apple M1 Pro
Memory: 103.61 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - /usr/local/bin/node
Yarn: 1.22.22 - ~/Code/passionfroot/remix/node_modules/.bin/yarn
npm: 10.8.2 - ~/Code/passionfroot/remix/node_modules/.bin/npm
pnpm: 8.14.0 - /usr/local/bin/pnpm
bun: 1.1.42 - ~/.bun/bin/bun
Browsers:
Chrome: 132.0.6834.160
Safari: 18.2
npmPackages:
@remix-run/dev: ^2.15.3 => 2.15.3
@remix-run/express: ^2.15.3 => 2.15.3
@remix-run/node: ^2.15.3 => 2.15.3
@remix-run/react: ^2.15.3 => 2.15.3
@remix-run/route-config: ^2.15.3 => 2.15.3
@remix-run/routes-option-adapter: ^2.15.3 => 2.15.3
vite: ^5.4.5 => 5.4.8
Used Package Manager
npm
Expected Behavior
It should not throw
Actual Behavior
Without any obvious reasons, from time to time our application crashes with the error Cannot read properties of null (reading 'useContext')
.
As you can see from the screenshot below, the issue is triggered by Remix - in this specific case by useParams
but I've seen triggered by useNavigation
, useLoaderData
, etc. It also doesn't seem to be related to any specific route as we are seeing it happening a bit everywhere in the app.