reduxjs/react-redux · critical
uSES not initialized!
Error message
uSES not initialized!
What it means
react-redux lazily assigns the real useSyncExternalStore implementation from use-sync-external-store into a mutable holder; notInitialized is the placeholder it installs until initialization. If any hook runs before setBatch/initialization (or the shim failed to load), this placeholder is invoked and throws.
Source
Thrown at src/utils/useSyncExternalStore.ts:5
import type { useSyncExternalStore } from 'use-sync-external-store'
import type { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'
export const notInitialized = () => {
throw new Error('uSES not initialized!')
}
export type uSES = typeof useSyncExternalStore
export type uSESWS = typeof useSyncExternalStoreWithSelector
View on GitHub (pinned to 16f1a91eb2)
Solutions
- Update react-redux (and use-sync-external-store) to matching latest versions
- Clear bundler cache and rebuild; check for duplicate react-redux installs with npm ls react-redux
- Remove any aliases or manual imports of react-redux internals / use-sync-external-store
- If using React 18+, rely on React's built-in useSyncExternalStore path by upgrading
Example fix
// before (aliased shim)
alias: { 'use-sync-external-store': false }
// after
npm i react-redux@latest use-sync-external-store@latest
// remove alias, rebuild Defensive patterns
Strategy: fallback
Validate before calling
// before app startup, sanity-check the shim initialized
import { unstable_batchedUpdates } from 'react-dom'
import { setBatch } from 'react-redux'
setBatch(unstable_batchedUpdates) Type guard
function isUseSyncExternalStoreReady(fn: unknown): boolean {
return typeof fn === 'function' && fn.name !== 'notInitialized';
} Try / catch
try {
const value = useSelector(selector)
} catch (e) {
if (e.message.includes('uSES not initialized')) {
console.error('Broken use-sync-external-store resolution: dedupe deps and rebuild')
}
throw e
} Prevention
- Keep react-redux and use-sync-external-store versions in lockstep
- Run npm dedupe / npm ls to eliminate duplicate copies
- Avoid bundler aliases or side-effect stripping around react-redux entry modules
- On React 18+, prefer versions of react-redux that use React's built-in useSyncExternalStore
When it happens
Trigger: Using useSelector/useSyncExternalStore before react-redux's internal initialization runs — usually caused by bundler/tree-shaking producing an incorrect module evaluation order, multiple react-redux copies, or a broken/partial build of use-sync-external-store.
Common situations: Aggressive bundler optimizations (e.g. side-effect-free reordering) with older webpack/rollup setups, ESM/CJS interop issues with use-sync-external-store, or patching/aliasing react-redux internals.
Related errors
- Invalid value of type ${typeof arg} for ${name} argument whe
- Unexpected value for ${methodName} in connect.
- could not find react-redux context value; please ensure the
- You must pass a selector to useSelector
- You must pass a function as a selector to useSelector
AI-assisted analysis of reduxjs/react-redux@16f1a91eb2 (2026-08-31).
Data as JSON: /api/errors/b8bfa599fa559d81.
Report an issue: GitHub.