# Error occurred prerendering page "/x". Read more: https://nextjs.org/docs/messages/prerender-error

**Code:** `Prerender error` · **Category:** React · **Seen on:** React

A page threw an error while Next.js was rendering it at build time.

## Meaning

next build renders static pages; any exception (undefined data, failing fetch, browser APIs during SSR) fails the build. The real error is printed above.

## Common causes

- Data fetch failing during build (API unreachable from CI)
- Accessing window/localStorage during render
- Undefined props/params at build time

## Quick fix

1. Read the error above the prerender message
2. Guard browser APIs with useEffect
3. Make the page dynamic if it needs runtime data
4. Provide env vars in the build environment

## Detailed fix by platform

### React

1. Run `next build --debug` for more detail

## How to diagnose

1. **Error** — What is printed above?
2. **Data** — Is the API reachable during build?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/react/nextjs-error-prerendering-page)
