facebook/react · error · Error

163

163

Error message

This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.

What it means

commitBeforeMutationEffectsOnFiber() handles pre-mutation snapshot work. Only class components (getSnapshotBeforeUpdate) and HostRoot (container reset) legitimately carry the Snapshot flag; the default branch treats Snapshot on any other tag as an impossible state and throws.

Source

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

            // This is a new mount. We should have handled this as part of the
            // Placement effect or it is deeper inside a entering transition.
          } else {
            // Something may have mutated within this subtree. This might need to cause
            // a cross-fade of this parent. We first assign old names to the
            // previous tree in the before mutation phase in case we need to.
            // TODO: This walks the tree that we might continue walking anyway.
            // We should just stash the parent ViewTransitionComponent and continue
            // walking the tree until we find HostComponent but to do that we need
            // to use a stack which requires refactoring this phase.
            commitBeforeUpdateViewTransition(current, finishedWork);
          }
        }
        break;
      }
    // Fallthrough
    default: {
      if ((flags & Snapshot) !== NoFlags) {
        throw new Error(
          'This unit of work tag should not have side-effects. This error is ' +
            'likely caused by a bug in React. Please file an issue.',
        );
      }
    }
  }
}

function commitBeforeMutationEffectsDeletion(
  deletion: Fiber,
  isViewTransitionEligible: boolean,
) {
  if (enableCreateEventHandleAPI) {
    // TODO (effects) It would be nice to avoid calling doesFiberContain()
    // Maybe we can repurpose one of the subtreeFlags positions for this instead?
    // Use it to store which part of the tree the focused instance is in?
    // This assumes we can safely determine that instance during the "render" phase.
    if (doesFiberContain(deletion, focusedInstanceHandle as any as Fiber)) {

View on GitHub (pinned to eafeac097b)

Solutions

  1. Update React to the latest patch/canary - flag-assignment bugs of this kind are fixed quickly
  2. Bisect the React version: if the error started right after an upgrade, report it against that release
  3. Reduce the repro by toggling getSnapshotBeforeUpdate usage and file an issue
  4. As a workaround, replace getSnapshotBeforeUpdate on the affected subtree with logic that avoids snapshots
Defensive patterns

Strategy: try-catch

Try / catch

Before-mutation-phase throw: not catchable by ErrorBoundaries. Log via onUncaughtError with the component stack and React version, report, and remount the root.

Prevention

When it happens

Trigger: React internal bugs where the Snapshot bit lands on a non-class, non-root fiber - historically associated with dehydrated Suspense boundaries and with new fiber tags landing before their before-mutation handling. No public API sets Snapshot directly.

Common situations: Canary builds after new component types shipped (ViewTransition, Activity); SSR hydration where snapshot work interleaves with dehydration; errors that appear immediately after a React upgrade.

Related errors


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