facebook/react · error · Error

160

160

Error message

Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.

What it means

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.

Source

Thrown at packages/react-reconciler/src/ReactFiberCommitHostEffects.js:481

  // Fragment ancestry is collected separately so portals remain placement
  // parents while fragment bookkeeping still walks past them to ancestors.
  const parentFragmentInstances = enableFragmentRefs
    ? getParentFragmentInstances(finishedWork)
    : null;

  // $FlowFixMe[constant-condition]
  if (!supportsMutation) {
    if (enableFragmentRefs) {
      commitImmutablePlacementNodeToFragmentInstances(
        finishedWork,
        parentFragmentInstances,
      );
    }
    return;
  }

  if (hostParentFiber == null) {
    throw new Error(
      'Expected to find a host parent. This error is likely caused by a bug ' +
        'in React. Please file an issue.',
    );
  }

  switch (hostParentFiber.tag) {
    case HostSingleton: {
      // $FlowFixMe[constant-condition]
      if (supportsSingletons) {
        const parent: Instance = hostParentFiber.stateNode;
        const before = getHostSibling(finishedWork);
        // We only have the top Fiber that was inserted but we need to recurse down its
        // children to find all the terminal nodes.
        insertOrAppendPlacementNode(
          finishedWork,
          before,
          parent,
          parentFragmentInstances,

View on GitHub (pinned to eafeac097b)

Solutions

  1. Update React - several missing-host-parent commit bugs were fixed across the 19.x line
  2. Remove manual DOM manipulation of portal/root containers (innerHTML = '' while React is mounted)
  3. Reproduce without ViewTransition/gesture wrappers; if the error disappears, file an issue with the minimal repro
  4. As a stopgap, defer the unmount or reorder that triggers it to a passive effect
Defensive patterns

Strategy: try-catch

Try / catch

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.

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of facebook/react@eafeac097b (2026-08-21). Data as JSON: /api/errors/9511839e656e8245. Report an issue: GitHub.