Got this debugging another error. Filing here for reference. Original code: https://phabricator.intern.facebook.com/P59317705
let isCommitting: boolean = false;
  let isRootReadyForCommit: boolean = false;
  let legacyErrorBoundariesThatAlreadyFailed: Set<mixed> | null = null;
  // Used for performance tracking.
  let interruptedBy: Fiber | null = null;
  let stashedWorkInProgressProperties;
  let replayUnitOfWork;
  if (__DEV__ && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
    stashedWorkInProgressProperties = null;
    replayUnitOfWork = (failedUnitOfWork: Fiber, isAsync: boolean) => {
      
      Object.assign(failedUnitOfWork, stashedWorkInProgressProperties);
      switch (failedUnitOfWork.tag) {
        case HostRoot:
          popHostContainer(failedUnitOfWork);
          popTopLevelLegacyContextObject(failedUnitOfWork);
          break;
        case HostComponent:
          popHostContext(failedUnitOfWork);
          break;
        case ClassComponent:
          popLegacyContextProvider(failedUnitOfWork);
          break;
        case HostPortal:
          popHostContainer(failedUnitOfWork);
          break;
        case ContextProvider:
          popProvider(failedUnitOfWork);
          break;
      }