{"record":{"id":"161307f22a352a35","repo":"facebook/react","slug":"349","errorCode":"349","errorMessage":"Expected a work-in-progress root. This is a bug in React. Please file an issue.","messagePattern":"Expected a work-in-progress root\\. This is a bug in React\\. Please file an issue\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-reconciler/src/ReactFiberBeginWork.js","lineNumber":1643,"sourceCode":"        const tempInstance = new ctor(\n          workInProgress.memoizedProps,\n          instance.context,\n        );\n        const state = tempInstance.state;\n        instance.updater.enqueueSetState(instance, state, null);\n        break;\n      }\n      case true: {\n        workInProgress.flags |= DidCapture;\n        workInProgress.flags |= ShouldCapture;\n        // eslint-disable-next-line react-internal/prod-error-codes\n        const error = new Error('Simulated error coming from DevTools');\n        const lane = pickArbitraryLane(renderLanes);\n        workInProgress.lanes = mergeLanes(workInProgress.lanes, lane);\n        // Schedule the error boundary to re-render using updated state\n        const root: FiberRoot | null = getWorkInProgressRoot();\n        if (root === null) {\n          throw new Error(\n            'Expected a work-in-progress root. This is a bug in React. Please file an issue.',\n          );\n        }\n        const update = createClassErrorUpdate(lane);\n        initializeClassErrorUpdate(\n          update,\n          root,\n          workInProgress,\n          createCapturedValueAtFiber(error, workInProgress),\n        );\n        enqueueCapturedUpdate(workInProgress, update);\n        break;\n      }\n    }\n  }\n\n  // Push context providers early to prevent context stack mismatches.\n  // During mounting we don't know the child context yet as the instance doesn't exist.","sourceCodeStart":1625,"sourceCodeEnd":1661,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-reconciler/src/ReactFiberBeginWork.js#L1625-L1661","documentation":"updateClassComponent() implements the React DevTools 'force the selected component to error' feature. In DEV builds, shouldError() returns true for a class component DevTools marked to fail; React fabricates a 'Simulated error coming from DevTools' and queues a class error update so the nearest boundary shows its fallback. Creating that update needs the root currently being rendered (getWorkInProgressRoot()); a null root means the render bookkeeping is broken.","triggerScenarios":"DevTools error simulation pressed on a class component while the work-in-progress root is unexpectedly null - an interrupted render, DevTools mutating the tree concurrently, or an internal state bug. DEV builds only; the entire switch is compiled out of production.","commonSituations":"Debugging with React DevTools open while hot-reloading or inspecting; an older DevTools extension against a newer React canary; StrictMode DEV double-rendering combined with DevTools interactions.","solutions":["Update the React DevTools extension to a version matching your React build","Retry with the DevTools error-simulation toggle off - this path cannot fire without DevTools","Reload the page - a null work-in-progress root is transient DEV state","If it reproduces with DevTools alone, file an issue describing the component tree shape"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined') {\n  if (__REACT_DEVTOOLS_GLOBAL_HOOK__.renderers.size === 0) {\n    console.warn('React DevTools failed to attach - update the extension to match your React version');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Update the React DevTools extension whenever you update React","Do not stack hot reload and DevTools error simulation on the same render","Ship production builds - this whole path is compiled out when NODE_ENV is production"],"tags":["devtools","dev-only","class-components","invariant"],"backgroundTag":"react-internal-invariant","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}