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

commitDeletionEffects() removes a deleted subtree's host nodes. It scans up the return path for the nearest host parent (singleton scope, HostComponent, HostRoot, or HostPortal) to know which container to remove children from. The throw means a deleted fiber had no host ancestor - the subtree was already detached from its container or the tree was corrupted.

Source

Thrown at packages/react-reconciler/src/ReactFiberCommitWork.js:1443

          }
          // Expected fallthrough when supportsSingletons is false
        }
        case HostComponent: {
          hostParent = parent.stateNode;
          hostParentIsContainer = false;
          break findParent;
        }
        case HostRoot:
        case HostPortal: {
          hostParent = parent.stateNode.containerInfo;
          hostParentIsContainer = true;
          break findParent;
        }
      }
      parent = parent.return;
    }
    if (hostParent === null) {
      throw new Error(
        'Expected to find a host parent. This error is likely caused by ' +
          'a bug in React. Please file an issue.',
      );
    }

    commitDeletionEffectsOnFiber(root, returnFiber, deletedFiber);
    hostParent = null;
    hostParentIsContainer = false;
  } else {
    // Detach refs and call componentWillUnmount() on the whole subtree.
    commitDeletionEffectsOnFiber(root, returnFiber, deletedFiber);
  }

  if (
    enableProfilerTimer &&
    enableProfilerCommitHooks &&
    enableComponentPerformanceTrack &&
    (deletedFiber.mode & ProfileMode) !== NoMode &&

View on GitHub (pinned to eafeac097b)

Solutions

  1. Update React - multiple 'Expected to find a host parent' deletion crashes were fixed across 19.x
  2. Stop removing React-owned DOM manually (root and portal containers)
  3. Avoid root.unmount() while updates are pending; flush or await the update first
  4. Reproduce and file an issue, noting whether ViewTransition or portals are involved

Example fix

// before - container emptied while React still owns deletions
root.unmount();
container.innerHTML = '';

// after - let React own the whole teardown
root.unmount();
Defensive patterns

Strategy: try-catch

Try / catch

Mutation-phase throw: not catchable by ErrorBoundaries. Register onUncaughtError on the root, log the unmount/update sequence that preceded it, and remount a fresh root to recover.

Prevention

When it happens

Trigger: React internal bugs where deletions are processed after the surrounding root/portal fiber was detached - reported with View Transition exits, unmount racing a pending commit, and custom renderers; also caused by user code removing a portal's container node before React processes the deletion.

Common situations: Unmounting roots or portals while concurrent commits are in flight; manually removing DOM that React owns; canary ViewTransition/gesture flows deleting exiting subtrees; often follows root.unmount() during a pending update.

Related errors


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