facebook/react · warning
Could not find element with id "${id}"
Error message
Could not find element with id "${id}" What it means
In updateSelectedElement() of the legacy DevTools backend, the internal instance was found in idToInternalInstanceMap, but its _currentElement is null. In the legacy reconciler _currentElement is cleared while the instance is between elements (mid re-render or during unmount), so DevTools cannot read props/type to build $r and warns instead. It means the instance exists but is not currently holding an element.
Source
Thrown at packages/react-devtools-shared/src/backend/legacy/renderer.js:702
style,
};
}
function updateSelectedElement(id: number): void {
const internalInstance = idToInternalInstanceMap.get(id);
if (internalInstance == null) {
console.warn(`Could not find instance with id "${id}"`);
return;
}
switch (getElementType(internalInstance)) {
case ElementTypeClass:
global.$r = internalInstance._instance;
break;
case ElementTypeFunction:
const element = internalInstance._currentElement;
if (element == null) {
console.warn(`Could not find element with id "${id}"`);
return;
}
global.$r = {
props: element.props,
type: element.type,
};
break;
default:
global.$r = null;
break;
}
}
function storeAsGlobal(
id: number,
path: Array<string | number>,
count: number,View on GitHub (pinned to eafeac097b)
Solutions
- Retry the selection after the current update finishes (re-click the element in the Components tree).
- Disable the update source (pause the network/timer, use 'pause on exceptions') while inspecting.
- Move the app to a modern React version so DevTools uses the Fiber backend, which reads props/type from the current Fiber instead.
Defensive patterns
Strategy: validation
Prevention
- Retry the selection after the in-flight commit finishes.
- Inspect components that are not mid-update (avoid selecting during animations/polling).
- Check that global.$r was actually set before using it in the console.
When it happens
Trigger: Selecting a function component instance that is mid-update or being unmounted when DevTools evaluates updateSelectedElement; calling 'store as global variable' during a re-render triggered by setState in render or a sync layout effect.
Common situations: Fast-updating legacy (React < 16) trees where the selection lands during a commit; HMR swapping elements; components that unmount right after being clicked in the tree.
Related errors
- Could not find instance with id "${id}"
- Cannot not suspend ID '${suspendedSet[i]}'.
- Invalid renderer id "${rendererID}" for element "${id}"
- Invalid renderer id "${match.rendererID}" for element "${mat
- Profiling data cannot be updated while profiling is in progr
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/cc37b413ac092f4d.
Report an issue: GitHub.