Error AtlasError Documentation and Resolution

Next.js router method called during prerendering

No Router Instance

Next.js detected router methods such as push, replace, or back being called while prerendering on the server, where no client router instance exists.

No Router Instanceruntime
No Router Instance
  • Router.push, replace, or back is called during SSR or SSG.
  • Client navigation logic runs during the initial server render.
  • A component invokes router methods before the browser environment is available.
  1. Move router method calls into useEffect in function components.
  2. In class components, move the calls into componentDidMount.
  3. Guard navigation logic so it only runs in the browser.
Next.js Docs: No Router Instance
Next.js No Router Instance: causes and fixes | Error Atlas