gatsbyjs/gatsby · error

You provided a custom replaceHydrateFunction that does not r

Error message

You provided a custom replaceHydrateFunction that does not return a cleanup function.

What it means

Dev-overlay guard when hiding Gatsby's loading indicator: the user-supplied replaceHydrateFunction returned a non-function, so there is no cleanup callback to call. The code logs this warning and falls back to ReactDOM.unmountComponentAtNode when available to unmount the indicator.

Source

Thrown at packages/gatsby/cache-dir/app.js:169

      )
      document.body.append(indicatorMountElement)
      cleanupFn = renderer(<Indicator />, indicatorMountElement)
    }, 1000)

    dismissLoadingIndicator = () => {
      clearTimeout(showIndicatorTimeout)
      if (indicatorMountElement) {
        // If user defined replaceHydrateFunction themselves the cleanupFn return might not be there
        // So fallback to unmountComponentAtNode if available
        if (cleanupFn && typeof cleanupFn === `function`) {
          cleanupFn()
        } else {
          if (typeof ReactDOM.unmountComponentAtNode === `function`) {
            ReactDOM.unmountComponentAtNode(indicatorMountElement)
          } else {
            // This was removed in React 19:
            // https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-unmountcomponentatnode.
            console.warn(
              `You provided a custom replaceHydrateFunction that does not return a cleanup function.`
            )
          }
        }
        indicatorMountElement.remove()
      }
    }
  }

  Promise.all([
    loader.loadPage(`/dev-404-page/`),
    loader.loadPage(`/404.html`),
    loader.loadPage(window.location.pathname + window.location.search),
  ]).then(() => {
    navigationInit()

    function onHydrated() {
      apiRunner(`onInitialClientRender`)

View on GitHub (pinned to e85d62f177)

Solutions

  1. Make your replaceHydrateFunction return a cleanup function that unmounts the root it created (as the default renderer does)
  2. Only a warning in development — no action needed if you accept the fallback unmount behavior
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/gatsby/cache-dir/app.js:169 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/dbf2e236b2a45174. Report an issue: GitHub.