{"record":{"id":"988abeee0e04968c","repo":"facebook/react","slug":"could-not-find-host-instance-from-fiber","errorCode":null,"errorMessage":"Could not find host instance from fiber","messagePattern":"Could not find host instance from fiber","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-native-renderer/src/ReactFabricComponentTree.js","lineNumber":40,"sourceCode":"function getInstanceFromNode(node: Instance | TextInstance): Fiber | null {\n  const instance: Instance = node as $FlowFixMe; // In React Native, node is never a text instance\n\n  if (\n    instance.canonical != null &&\n    instance.canonical.internalInstanceHandle != null\n  ) {\n    return instance.canonical.internalInstanceHandle;\n  }\n\n  // $FlowFixMe[incompatible-type] DevTools incorrectly passes a fiber in React Native.\n  return node;\n}\n\nfunction getNodeFromInstance(fiber: Fiber): PublicInstance {\n  const publicInstance = getPublicInstance(fiber.stateNode);\n\n  if (publicInstance == null) {\n    throw new Error('Could not find host instance from fiber');\n  }\n\n  return publicInstance;\n}\n\nfunction getFiberCurrentPropsFromNode(instance: Instance): Props {\n  return instance.canonical.currentProps;\n}\n\nexport {\n  getInstanceFromNode,\n  getInstanceFromNode as getClosestInstanceFromNode,\n  getNodeFromInstance,\n  getFiberCurrentPropsFromNode,\n};\n","sourceCodeStart":22,"sourceCodeEnd":56,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-native-renderer/src/ReactFabricComponentTree.js#L22-L56","documentation":"ReactFabricComponentTree.getNodeFromInstance maps a Fiber to its host public instance for DevTools/Inspector glue (the file itself notes 'DevTools incorrectly passes a fiber in React Native'). If the fiber's stateNode yields no public instance - because the fiber is not attached to a host view, is mid-update, or belongs to another renderer - it throws instead of returning null.","triggerScenarios":"React DevTools or the RN Inspector calling component-tree hooks (getInstanceFromNode / inspector data collection) with a fiber whose stateNode has no public host instance: a non-host fiber, a fiber between commit phases, or a fiber from a different embedded renderer.","commonSituations":"React DevTools version out of sync with the RN bundle's react version; inspecting during fast commits or unmounts; mixed renderers inside one RN tree.","solutions":["Update React DevTools to the version matching your react/react-native pair.","Inspect a settled host component (View/Text) rather than mid-animation or non-host fibers.","If it reproduces on matched versions, capture the component stack and file a React issue - this seam is an acknowledged DevTools/renderer mismatch."],"exampleFix":"// before (DevTools/inspector glue)\nconst node = getNodeFromInstance(fiber); // throws for fibers without a host instance\n\n// after\nconst publicInstance =\n  fiber.stateNode != null ? getPublicInstance(fiber.stateNode) : null;\nif (publicInstance == null) return null; // skip fibers not backed by a host view\nreturn getNodeFromInstance(fiber);","handlingStrategy":"validation","validationCode":"// in custom DevTools/inspector glue: skip fibers without a host instance\nconst publicInstance =\n  fiber.stateNode != null ? getPublicInstance(fiber.stateNode) : null;\nif (publicInstance == null) return null; // not backed by a host view\nreturn getNodeFromInstance(fiber);","typeGuard":"const isHostBackedFiber = fiber =>\n  fiber != null && fiber.stateNode != null &&\n  getPublicInstance(fiber.stateNode) != null;","tryCatchPattern":null,"preventionTips":["Keep React DevTools and the RN bundle's react version in sync.","Inspect settled host components rather than mid-commit or non-host fibers.","Wrap custom inspector glue with null checks instead of assuming every fiber has a host instance."],"tags":["react-native","devtools","inspector","fiber","host-instance"],"backgroundTag":"devtools-renderer-version-mismatch","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}