{"record":{"id":"b8bfa599fa559d81","repo":"reduxjs/react-redux","slug":"uses-not-initialized","errorCode":null,"errorMessage":"uSES not initialized!","messagePattern":"uSES not initialized!","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/utils/useSyncExternalStore.ts","lineNumber":5,"sourceCode":"import type { useSyncExternalStore } from 'use-sync-external-store'\nimport type { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector'\n\nexport const notInitialized = () => {\n  throw new Error('uSES not initialized!')\n}\n\nexport type uSES = typeof useSyncExternalStore\nexport type uSESWS = typeof useSyncExternalStoreWithSelector\n","sourceCodeStart":1,"sourceCodeEnd":10,"githubUrl":"https://github.com/reduxjs/react-redux/blob/16f1a91eb2cc3817bf63753e8c90e528a9f0580c/src/utils/useSyncExternalStore.ts#L1-L10","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (aliased shim)\nalias: { 'use-sync-external-store': false }\n// after\nnpm i react-redux@latest use-sync-external-store@latest\n// remove alias, rebuild","handlingStrategy":"fallback","validationCode":"// before app startup, sanity-check the shim initialized\nimport { unstable_batchedUpdates } from 'react-dom'\nimport { setBatch } from 'react-redux'\nsetBatch(unstable_batchedUpdates)","typeGuard":"function isUseSyncExternalStoreReady(fn: unknown): boolean {\n  return typeof fn === 'function' && fn.name !== 'notInitialized';\n}","tryCatchPattern":"try {\n  const value = useSelector(selector)\n} catch (e) {\n  if (e.message.includes('uSES not initialized')) {\n    console.error('Broken use-sync-external-store resolution: dedupe deps and rebuild')\n  }\n  throw e\n}","preventionTips":["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"],"tags":["react-redux","initialization","usesyncexternalstore","bundler"],"backgroundTag":"uses-not-initialized","analyzedSha":"16f1a91eb2cc3817bf63753e8c90e528a9f0580c","analyzedAt":"2026-08-31T22:28:37.628Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}