Skip to content
DocsErrorsStatic Bail Out Caught

Static Bail Out Caught

Why This Error Occurred

When Partial Prerendering (PPR) is enabled, using APIs that opt into Dynamic Rendering like cookies, headers, or fetch (such as with cache: 'no-store' or revalidate: 0) will cause React to throw a special error object to know which part of the page cannot be statically generated - while still letting the rest of it be partially static. If you catch this error, it is not safe for us to generate any static data, and your build will fail.

Possible Ways to Fix It

  • Ensure that you are not wrapping Next.js APIs that opt into dynamic rendering in a try/catch block.
  • If you do wrap these APIs in a try/catch, make sure you re-throw the original error so it can be caught by Next.js.
  • Alternatively, insert unstable_noStore() before the try/catch.
import { unstable_noStore } from 'next/cache'
 
async function fetchData() {
  unstable_noStore() // opt out before we even get to the try/catch
  try {
    const response = await fetch(url);
    ...
  } catch (x) {
    ...
  }
}