{"record":{"id":"9511839e656e8245","repo":"facebook/react","slug":"160","errorCode":"160","errorMessage":"Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.","messagePattern":"Expected to find a host parent\\. This error is likely caused by a bug in React\\. Please file an issue\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-reconciler/src/ReactFiberCommitHostEffects.js","lineNumber":481,"sourceCode":"  // Fragment ancestry is collected separately so portals remain placement\n  // parents while fragment bookkeeping still walks past them to ancestors.\n  const parentFragmentInstances = enableFragmentRefs\n    ? getParentFragmentInstances(finishedWork)\n    : null;\n\n  // $FlowFixMe[constant-condition]\n  if (!supportsMutation) {\n    if (enableFragmentRefs) {\n      commitImmutablePlacementNodeToFragmentInstances(\n        finishedWork,\n        parentFragmentInstances,\n      );\n    }\n    return;\n  }\n\n  if (hostParentFiber == null) {\n    throw new Error(\n      'Expected to find a host parent. This error is likely caused by a bug ' +\n        'in React. Please file an issue.',\n    );\n  }\n\n  switch (hostParentFiber.tag) {\n    case HostSingleton: {\n      // $FlowFixMe[constant-condition]\n      if (supportsSingletons) {\n        const parent: Instance = hostParentFiber.stateNode;\n        const before = getHostSibling(finishedWork);\n        // We only have the top Fiber that was inserted but we need to recurse down its\n        // children to find all the terminal nodes.\n        insertOrAppendPlacementNode(\n          finishedWork,\n          before,\n          parent,\n          parentFragmentInstances,","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-reconciler/src/ReactFiberCommitHostEffects.js#L463-L499","documentation":"commitPlacement() inserts a newly placed host node into the host tree. It walks the fiber's return path looking for a host parent (HostComponent, HostSingleton, HostRoot, or HostPortal) and throws when none exists - every placed node must live inside a host container. A missing host parent means the return chain is broken or the container fiber was detached mid-commit.","triggerScenarios":"React internal bugs in commit scheduling - historically seen around View Transition exits, gesture commits, and re-placing subtrees whose portal or root ancestor was already unmounted; custom renderers whose host config reports supportsMutation incorrectly.","commonSituations":"Canary React with experimental ViewTransition/gesture features; unmounting a root while a placement from the same commit is still pending; portal containers removed from the DOM out from under React; usually shrinks to a small delete-then-insert sequence.","solutions":["Update React - several missing-host-parent commit bugs were fixed across the 19.x line","Remove manual DOM manipulation of portal/root containers (innerHTML = '' while React is mounted)","Reproduce without ViewTransition/gesture wrappers; if the error disappears, file an issue with the minimal repro","As a stopgap, defer the unmount or reorder that triggers it to a passive effect"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Mutation-phase throw: not catchable by ErrorBoundaries. Register onUncaughtError on the root, log the React version and the update/delete sequence that preceded it, report the bug, and remount the root to recover.","preventionTips":["Never clear a React-managed container's innerHTML manually","Keep portal containers mounted for the portal's entire lifetime","Pin stable React versions in apps using experimental ViewTransition or gesture APIs"],"tags":["commit-phase","placement","host-tree","invariant"],"backgroundTag":"host-parent-not-found","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}