facebook/react · error · Error
Expected mounted root to have known pseudo key.
Error message
Expected mounted root to have known pseudo key.
What it means
After resolving the root instance for a HostRoot fiber, getPathFrame() requires rootPseudoKeys to contain an entry for that instance's id. The pseudo key is written by setRootPseudoKey at initial flush, filter re-mount, and commit; the throw means a known root instance reached path computation without ever being keyed - registration and keying got out of sync.
Source
Thrown at packages/react-devtools-shared/src/backend/fiber/renderer.js:7853
}
function getPathFrame(fiber: Fiber): PathFrame {
const {key} = fiber;
let displayName = getDisplayNameForFiber(fiber);
const index = fiber.index;
switch (fiber.tag) {
case HostRoot:
// Roots don't have a real displayName, index, or key.
// Instead, we'll use the pseudo key (childDisplayName:indexWithThatName).
const rootInstance = rootToFiberInstanceMap.get(fiber.stateNode);
if (rootInstance === undefined) {
throw new Error(
'Expected the root instance to exist when computing a path',
);
}
const pseudoKey = rootPseudoKeys.get(rootInstance.id);
if (pseudoKey === undefined) {
throw new Error('Expected mounted root to have known pseudo key.');
}
displayName = pseudoKey;
break;
case HostComponent:
displayName = fiber.type;
break;
default:
break;
}
return {
displayName,
key: key === REACT_OPTIMISTIC_KEY ? null : key,
index,
};
}
function getVirtualPathFrame(virtualInstance: VirtualInstance): PathFrame {
return {View on GitHub (pinned to eafeac097b)
Solutions
- Reload the page with DevTools open to rebuild all root keys.
- Re-select the element after the tree settles instead of relying on a selection persisted across the mount.
- Update DevTools; keying coverage fixes land in react-devtools-shared.
- Report a repro if current versions still throw.
Defensive patterns
Strategy: validation
Validate before calling
// only persist/restore selection paths after the target root has committed and appears in the tree
const rootVisible = store.getElementByID(rootTreeID) != null;
if (rootVisible) {
persistSelectionPath(id);
} Prevention
- Re-select elements after roots mount rather than restoring selections captured mid-mount.
- Reload with DevTools open so all roots are keyed during initial flush.
- Update DevTools for root-keying coverage fixes.
When it happens
Trigger: Path computation for a root that was registered in rootToFiberInstanceMap but skipped setRootPseudoKey - roots that appeared mid filter re-mount or during the attach window, or bookkeeping partially rewritten by a re-mount.
Common situations: Selection capture/restore right as a root mounts; toggling filters in multi-root apps; DevTools attach racing root creation.
Related errors
- Expected root pseudo key to be known.
- Expected counter to be known.
- Expected the root instance to exist when computing a path
- Expected to see a frame at the next depth.
- Expected a root instance to exist for this Fiber root
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/dc9f7d381bfefaf8.
Report an issue: GitHub.