silverwolf-x/project / errors /ppr-caught-error.mdx
silverwolf-x's picture
download
raw
1.13 kB
---
title: 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()`](/docs/app/api-reference/functions/unstable_noStore) before the try/catch.
```js
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) {
...
}
}
```

Xet Storage Details

Size:
1.13 kB
·
Xet hash:
16e68cab6c42d0c546b528bd8b1693054620413cc123f7ef06188b01131cf261

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.