{"record":{"id":"9cab33e8785d5476","repo":"facebook/react","slug":"should-have-a-root-instance-for-a-committed-root","errorCode":null,"errorMessage":"Should have a root instance for a committed root. This is a bug in React DevTools.","messagePattern":"Should have a root instance for a committed root\\. This is a bug in React DevTools\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-devtools-shared/src/backend/fiber/renderer.js","lineNumber":5031,"sourceCode":"  }\n\n  function handlePostCommitFiberRoot(root: FiberRoot) {\n    if (isProfiling && rootSupportsProfiling(root)) {\n      if (currentCommitProfilingMetadata !== null) {\n        const {effectDuration, passiveEffectDuration} =\n          getEffectDurations(root);\n        // $FlowFixMe[incompatible-use] found when upgrading Flow\n        currentCommitProfilingMetadata.effectDuration = effectDuration;\n        // $FlowFixMe[incompatible-use] found when upgrading Flow\n        currentCommitProfilingMetadata.passiveEffectDuration =\n          passiveEffectDuration;\n      }\n    }\n\n    if (needsToFlushComponentLogs) {\n      const rootInstance = rootToFiberInstanceMap.get(root);\n      if (rootInstance === undefined) {\n        throw new Error(\n          'Should have a root instance for a committed root. This is a bug in React DevTools.',\n        );\n      }\n      // We received new logs after commit. I.e. in a passive effect. We need to\n      // traverse the tree to find the affected ones. If we just moved the whole\n      // tree traversal from handleCommitFiberRoot to handlePostCommitFiberRoot\n      // this wouldn't be needed. For now we just brute force check all instances.\n      // This is not that common of a case.\n      bruteForceFlushErrorsAndWarnings(rootInstance);\n    }\n  }\n\n  function handleCommitFiberRoot(\n    root: FiberRoot,\n    priorityLevel: void | number,\n  ) {\n    const nextFiber = root.current;\n","sourceCodeStart":5013,"sourceCodeEnd":5049,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-devtools-shared/src/backend/fiber/renderer.js#L5013-L5049","documentation":"Post-commit flush invariant in the DevTools backend: component console logs queued during passive effects (needsToFlushComponentLogs) arrive for a root that rootToFiberInstanceMap no longer contains. The message itself states this is a bug in React DevTools - the root's mirror was dropped (unmounted or reset) while queued logs still referenced it.","triggerScenarios":"Passive effects logging after the root was unmounted in the same commit window; roots removed between handleCommitFiberRoot and handlePostCommitFiberRoot; multiple roots where one is torn down while logs are pending.","commonSituations":"Apps that unmount roots (micro-frontends, test harnesses, hot reload) while components log in cleanup/passive effects; DevTools attached across root teardown.","solutions":["Update React DevTools to the latest release (this class of bug gets patched by release)","Reload the page with DevTools attached to re-establish root tracking","Report with a repro of root unmount plus passive-effect logging","If embedding the backend, skip the flush when the root is missing instead of crashing"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  backend.handlePostCommitFiberRoot(renderer, root);\n} catch (e) {\n  if (/Should have a root instance for a committed root/.test(e.message)) {\n    unregisterRoot(root); // root was torn down; drop queued logs\n  } else throw e;\n}","preventionTips":["Update DevTools - the message itself declares a DevTools bug","Reload after unmounting roots (micro-frontends, hot reload, test harnesses) with DevTools attached","Report root unmount + passive-effect logging repros","When embedding, guard the flush with a root-existence check or catch-and-skip"],"tags":["react-devtools","invariant","root-instance","console-logs","internal"],"backgroundTag":"devtools-root-state-invariant","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}