{"record":{"id":"dbf2e236b2a45174","repo":"gatsbyjs/gatsby","slug":"you-provided-a-custom-replacehydratefunction-that","errorCode":null,"errorMessage":"You provided a custom replaceHydrateFunction that does not return a cleanup function.","messagePattern":"You provided a custom replaceHydrateFunction that does not return a cleanup function\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/cache-dir/app.js","lineNumber":169,"sourceCode":"      )\n      document.body.append(indicatorMountElement)\n      cleanupFn = renderer(<Indicator />, indicatorMountElement)\n    }, 1000)\n\n    dismissLoadingIndicator = () => {\n      clearTimeout(showIndicatorTimeout)\n      if (indicatorMountElement) {\n        // If user defined replaceHydrateFunction themselves the cleanupFn return might not be there\n        // So fallback to unmountComponentAtNode if available\n        if (cleanupFn && typeof cleanupFn === `function`) {\n          cleanupFn()\n        } else {\n          if (typeof ReactDOM.unmountComponentAtNode === `function`) {\n            ReactDOM.unmountComponentAtNode(indicatorMountElement)\n          } else {\n            // This was removed in React 19:\n            // https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-unmountcomponentatnode.\n            console.warn(\n              `You provided a custom replaceHydrateFunction that does not return a cleanup function.`\n            )\n          }\n        }\n        indicatorMountElement.remove()\n      }\n    }\n  }\n\n  Promise.all([\n    loader.loadPage(`/dev-404-page/`),\n    loader.loadPage(`/404.html`),\n    loader.loadPage(window.location.pathname + window.location.search),\n  ]).then(() => {\n    navigationInit()\n\n    function onHydrated() {\n      apiRunner(`onInitialClientRender`)","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/cache-dir/app.js#L151-L187","documentation":"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.","triggerScenarios":"Thrown at packages/gatsby/cache-dir/app.js:169 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make your replaceHydrateFunction return a cleanup function that unmounts the root it created (as the default renderer does)","Only a warning in development — no action needed if you accept the fallback unmount behavior"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}