diff --git a/docs/01-app/02-guides/incremental-static-regeneration.mdx b/docs/01-app/02-guides/incremental-static-regeneration.mdx
index 7e0a3e1a15762..f1fad43e3ec94 100644
--- a/docs/01-app/02-guides/incremental-static-regeneration.mdx
+++ b/docs/01-app/02-guides/incremental-static-regeneration.mdx
@@ -464,7 +464,7 @@ If you are using on-demand revalidation, you do not need to specify a `revalidat
-If an error is thrown while attempting to revalidate data, the last successfully generated data will continue to be served from the cache. On the next subsequent request, Next.js will retry revalidating the data. [Learn more about error handling](/docs/app/building-your-application/routing/error-handling).
+If an error is thrown while attempting to revalidate data, the last successfully generated data will continue to be served from the cache. On the next subsequent request, Next.js will retry revalidating the data. [Learn more about error handling](/docs/app/getting-started/error-handling).
diff --git a/docs/01-app/02-guides/index.mdx b/docs/01-app/02-guides/index.mdx
index b44f166fde68c..808a270bd0917 100644
--- a/docs/01-app/02-guides/index.mdx
+++ b/docs/01-app/02-guides/index.mdx
@@ -19,8 +19,8 @@ description: Learn how to implement common UI patterns and use cases using Next.
- [Showing a pending state while submitting a form](/docs/app/guides/forms)
- [Server-side form validation](/docs/app/guides/forms)
-- [Handling expected errors](/docs/app/building-your-application/routing/error-handling#handling-expected-errors-from-server-actions)
-- [Handling unexpected exceptions](/docs/app/building-your-application/routing/error-handling#uncaught-exceptions)
+- [Handling expected errors](/docs/app/getting-started/error-handling#handling-expected-errors)
+- [Handling unexpected exceptions](/docs/app/getting-started/error-handling#handling-uncaught-exceptions)
- [Showing optimistic UI updates](/docs/app/guides/forms#optimistic-updates)
- [Programmatic form submission](/docs/app/guides/forms#programmatic-form-submission)
diff --git a/docs/01-app/02-guides/migrating/app-router-migration.mdx b/docs/01-app/02-guides/migrating/app-router-migration.mdx
index 5bdde4d95f8ca..9dae588fbd630 100644
--- a/docs/01-app/02-guides/migrating/app-router-migration.mdx
+++ b/docs/01-app/02-guides/migrating/app-router-migration.mdx
@@ -113,7 +113,7 @@ We recommend reducing the combined complexity of these updates by breaking down
- You can colocate other files inside the `app` directory such as components, styles, tests, and more. [Learn more](/docs/app/building-your-application/routing).
- Data fetching functions like `getServerSideProps` and `getStaticProps` have been replaced with [a new API](/docs/app/building-your-application/data-fetching) inside `app`. `getStaticPaths` has been replaced with [`generateStaticParams`](/docs/app/api-reference/functions/generate-static-params).
- `pages/_app.js` and `pages/_document.js` have been replaced with a single `app/layout.js` root layout. [Learn more](/docs/app/api-reference/file-conventions/layout#root-layout).
-- `pages/_error.js` has been replaced with more granular `error.js` special files. [Learn more](/docs/app/building-your-application/routing/error-handling).
+- `pages/_error.js` has been replaced with more granular `error.js` special files. [Learn more](/docs/app/getting-started/error-handling).
- `pages/404.js` has been replaced with the [`not-found.js`](/docs/app/api-reference/file-conventions/not-found) file.
- `pages/api/*` API Routes have been replaced with the [`route.js`](/docs/app/api-reference/file-conventions/route) (Route Handler) special file.
diff --git a/docs/01-app/02-guides/production-checklist.mdx b/docs/01-app/02-guides/production-checklist.mdx
index 9ac74598d49e5..710596c87c39f 100644
--- a/docs/01-app/02-guides/production-checklist.mdx
+++ b/docs/01-app/02-guides/production-checklist.mdx
@@ -42,7 +42,7 @@ While building your application, we recommend using the following features to en
- **[Layouts](/docs/app/api-reference/file-conventions/layout):** Use layouts to share UI across pages and enable [partial rendering](/docs/app/building-your-application/routing/linking-and-navigating#4-partial-rendering) on navigation.
- **[`` component](/docs/app/building-your-application/routing/linking-and-navigating#link-component):** Use the `` component for [client-side navigation and prefetching](/docs/app/building-your-application/routing/linking-and-navigating#how-routing-and-navigation-works).
-- **[Error Handling](/docs/app/building-your-application/routing/error-handling):** Gracefully handle [catch-all errors](/docs/app/building-your-application/routing/error-handling) and [404 errors](/docs/app/api-reference/file-conventions/not-found) in production by creating custom error pages.
+- **[Error Handling](/docs/app/getting-started/error-handling):** Gracefully handle [catch-all errors](/docs/app/getting-started/error-handling) and [404 errors](/docs/app/api-reference/file-conventions/not-found) in production by creating custom error pages.
- **[Client and Server Components](/docs/app/getting-started/server-and-client-components#examples):** Follow the recommended composition patterns for Server and Client Components, and check the placement of your [`"use client"` boundaries](/docs/app/getting-started/server-and-client-components#examples#moving-client-components-down-the-tree) to avoid unnecessarily increasing your client-side JavaScript bundle.
- **[Dynamic APIs](/docs/app/getting-started/partial-prerendering#dynamic-rendering):** Be aware that Dynamic APIs like [`cookies`](/docs/app/api-reference/functions/cookies) and the [`searchParams`](/docs/app/api-reference/file-conventions/page#searchparams-optional) prop will opt the entire route into [Dynamic Rendering](/docs/app/getting-started/partial-prerendering#dynamic-rendering) (or your whole application if used in the [Root Layout](/docs/app/api-reference/file-conventions/layout#root-layout)). Ensure Dynamic API usage is intentional and wrap them in `` boundaries where appropriate.
diff --git a/docs/01-app/03-building-your-application/01-routing/05-error-handling.mdx b/docs/01-app/03-building-your-application/01-routing/05-error-handling.mdx
deleted file mode 100644
index d8e2795cee261..0000000000000
--- a/docs/01-app/03-building-your-application/01-routing/05-error-handling.mdx
+++ /dev/null
@@ -1,268 +0,0 @@
----
-title: Error Handling
-description: Learn how to display expected errors and handle uncaught exceptions.
-related:
- links:
- - app/api-reference/file-conventions/error
----
-
-Errors can be divided into two categories: **expected errors** and **uncaught exceptions**:
-
-- **Model expected errors as return values**: Avoid using `try`/`catch` for expected errors in Server Actions. Use [`useActionState`](https://react.dev/reference/react/useActionState) to manage these errors and return them to the client.
-- **Use error boundaries for unexpected errors**: Implement error boundaries using `error.tsx` and `global-error.tsx` files to handle unexpected errors and provide a fallback UI.
-
-## Handling Expected Errors
-
-Expected errors are those that can occur during the normal operation of the application, such as those from [server-side form validation](/docs/app/guides/forms) or failed requests. These errors should be handled explicitly and returned to the client.
-
-### Handling Expected Errors from Server Actions
-
-Use the `useActionState` hook to manage the state of Server Actions, including handling errors. This approach avoids `try`/`catch` blocks for expected errors, which should be modeled as return values rather than thrown exceptions.
-
-```ts filename="app/actions.ts" switcher
-'use server'
-
-import { redirect } from 'next/navigation'
-
-export async function createUser(prevState: any, formData: FormData) {
- const res = await fetch('https://...')
- const json = await res.json()
-
- if (!res.ok) {
- return { message: 'Please enter a valid email' }
- }
-
- redirect('/dashboard')
-}
-```
-
-```js filename="app/actions.js" switcher
-'use server'
-
-import { redirect } from 'next/navigation'
-
-export async function createUser(prevState, formData) {
- const res = await fetch('https://...')
- const json = await res.json()
-
- if (!res.ok) {
- return { message: 'Please enter a valid email' }
- }
-
- redirect('/dashboard')
-}
-```
-
-Then, you can pass your action to the `useActionState` hook and use the returned `state` to display an error message.
-
-```tsx filename="app/ui/signup.tsx" highlight={11,18-20} switcher
-'use client'
-
-import { useActionState } from 'react'
-import { createUser } from '@/app/actions'
-
-const initialState = {
- message: '',
-}
-
-export function Signup() {
- const [state, formAction, pending] = useActionState(createUser, initialState)
-
- return (
-
- )
-}
-```
-
-```jsx filename="app/ui/signup.js" highlight={11,18-20} switcher
-'use client'
-
-import { useActionState } from 'react'
-import { createUser } from '@/app/actions'
-
-const initialState = {
- message: '',
-}
-
-export function Signup() {
- const [state, formAction, pending] = useActionState(createUser, initialState)
-
- return (
-
- )
-}
-```
-
-You could also use the returned state to display a toast message from the Client Component.
-
-### Handling Expected Errors from Server Components
-
-When fetching data inside of a Server Component, you can use the response to conditionally render an error message or [`redirect`](/docs/app/guides/redirecting#redirect-function).
-
-```tsx filename="app/page.tsx" switcher
-export default async function Page() {
- const res = await fetch(`https://...`)
- const data = await res.json()
-
- if (!res.ok) {
- return 'There was an error.'
- }
-
- return '...'
-}
-```
-
-```jsx filename="app/page.js" switcher
-export default async function Page() {
- const res = await fetch(`https://...`)
- const data = await res.json()
-
- if (!res.ok) {
- return 'There was an error.'
- }
-
- return '...'
-}
-```
-
-## Uncaught Exceptions
-
-Uncaught exceptions are unexpected errors that indicate bugs or issues that should not occur during the normal flow of your application. These should be handled by throwing errors, which will then be caught by error boundaries.
-
-- **Common:** Handle uncaught errors below the root layout with `error.js`.
-- **Optional:** Handle granular uncaught errors with nested `error.js` files (e.g. `app/dashboard/error.js`)
-- **Uncommon:** Handle uncaught errors in the root layout with `global-error.js`.
-
-### Using Error Boundaries
-
-Next.js uses error boundaries to handle uncaught exceptions. Error boundaries catch errors in their child components and display a fallback UI instead of the component tree that crashed.
-
-Create an error boundary by adding an `error.tsx` file inside a route segment and exporting a React component:
-
-```tsx filename="app/dashboard/error.tsx" switcher
-'use client' // Error boundaries must be Client Components
-
-import { useEffect } from 'react'
-
-export default function Error({
- error,
- reset,
-}: {
- error: Error & { digest?: string }
- reset: () => void
-}) {
- useEffect(() => {
- // Log the error to an error reporting service
- console.error(error)
- }, [error])
-
- return (
-
-
Something went wrong!
-
-
- )
-}
-```
-
-```jsx filename="app/dashboard/error.js" switcher
-'use client' // Error boundaries must be Client Components
-
-import { useEffect } from 'react'
-
-export default function Error({ error, reset }) {
- useEffect(() => {
- // Log the error to an error reporting service
- console.error(error)
- }, [error])
-
- return (
-
-
Something went wrong!
-
-
- )
-}
-```
-
-If you want errors to bubble up to the parent error boundary, you can `throw` when rendering the `error` component.
-
-### Handling Errors in Nested Routes
-
-Errors will bubble up to the nearest parent error boundary. This allows for granular error handling by placing `error.tsx` files at different levels in the [route hierarchy](/docs/app/getting-started/project-structure#component-hierarchy).
-
-
-
-### Handling Global Errors
-
-While less common, you can handle errors in the root layout using `app/global-error.js`, located in the root app directory, even when leveraging [internationalization](/docs/app/guides/internationalization). Global error UI must define its own `` and `` tags, since it is replacing the root layout or template when active.
-
-```tsx filename="app/global-error.tsx" switcher
-'use client' // Error boundaries must be Client Components
-
-export default function GlobalError({
- error,
- reset,
-}: {
- error: Error & { digest?: string }
- reset: () => void
-}) {
- return (
- // global-error must include html and body tags
-
-
-
Something went wrong!
-
-
-
- )
-}
-```
-
-```jsx filename="app/global-error.js" switcher
-'use client' // Error boundaries must be Client Components
-
-export default function GlobalError({ error, reset }) {
- return (
- // global-error must include html and body tags
-
-
-
Something went wrong!
-
-
-
- )
-}
-```
diff --git a/docs/01-app/03-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx b/docs/01-app/03-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx
index 21d1523337bcf..5ad9eecf9e830 100644
--- a/docs/01-app/03-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx
+++ b/docs/01-app/03-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx
@@ -259,7 +259,7 @@ Remember to consider the [behavior and caveats](https://react.dev/reference/reac
### Error Handling
-When an error is thrown, it'll be caught by the nearest `error.js` or `` boundary on the client. See [Error Handling](/docs/app/building-your-application/routing/error-handling) for more information.
+When an error is thrown, it'll be caught by the nearest `error.js` or `` boundary on the client. See [Error Handling](/docs/app/getting-started/error-handling) for more information.
> **Good to know:**
>
diff --git a/docs/01-app/05-api-reference/03-file-conventions/error.mdx b/docs/01-app/05-api-reference/03-file-conventions/error.mdx
index 8a3969069099b..6705c1bad4ac6 100644
--- a/docs/01-app/05-api-reference/03-file-conventions/error.mdx
+++ b/docs/01-app/05-api-reference/03-file-conventions/error.mdx
@@ -4,7 +4,7 @@ description: API reference for the error.js special file.
related:
title: Learn more about error handling
links:
- - app/building-your-application/routing/error-handling
+ - app/getting-started/error-handling
---
An **error** file allows you to handle unexpected runtime errors and display fallback UI.
diff --git a/docs/01-app/05-api-reference/03-file-conventions/layout.mdx b/docs/01-app/05-api-reference/03-file-conventions/layout.mdx
index e68393bcfe979..2d44622d8599a 100644
--- a/docs/01-app/05-api-reference/03-file-conventions/layout.mdx
+++ b/docs/01-app/05-api-reference/03-file-conventions/layout.mdx
@@ -53,7 +53,7 @@ export default function RootLayout({ children }) {
#### `children` (required)
-Layout components accept and use a `children` prop. During rendering, `children` will be populated with the route segments the layout is wrapping. These will primarily be the component of a child [Layout](/docs/app/api-reference/file-conventions/page) (if it exists) or [Page](/docs/app/api-reference/file-conventions/page), but could also be other special files like [Loading](/docs/app/building-your-application/routing/loading-ui-and-streaming) or [Error](/docs/app/building-your-application/routing/error-handling) when applicable.
+Layout components should accept and use a `children` prop. During rendering, `children` will be populated with the route segments the layout is wrapping. These will primarily be the component of a child [Layout](/docs/app/api-reference/file-conventions/page) (if it exists) or [Page](/docs/app/api-reference/file-conventions/page), but could also be other special files like [Loading](/docs/app/building-your-application/routing/loading-ui-and-streaming) or [Error](/docs/app/getting-started/error-handling) when applicable.
#### `params` (optional)
diff --git a/docs/01-app/05-api-reference/03-file-conventions/parallel-routes.mdx b/docs/01-app/05-api-reference/03-file-conventions/parallel-routes.mdx
index 7641911d9eab4..a250c4adc37f1 100644
--- a/docs/01-app/05-api-reference/03-file-conventions/parallel-routes.mdx
+++ b/docs/01-app/05-api-reference/03-file-conventions/parallel-routes.mdx
@@ -477,4 +477,4 @@ Parallel Routes can be streamed independently, allowing you to define independen
height="1218"
/>
-See the [Loading UI](/docs/app/building-your-application/routing/loading-ui-and-streaming) and [Error Handling](/docs/app/building-your-application/routing/error-handling) documentation for more information.
+See the [Loading UI](/docs/app/building-your-application/routing/loading-ui-and-streaming) and [Error Handling](/docs/app/getting-started/error-handling) documentation for more information.
diff --git a/errors/prerender-error.mdx b/errors/prerender-error.mdx
index 9815ed323f41d..ccd6d3fe65564 100644
--- a/errors/prerender-error.mdx
+++ b/errors/prerender-error.mdx
@@ -133,7 +133,7 @@ export default function Page() {
## Additional Resources
-- [Handling Errors in Next.js](/docs/app/building-your-application/routing/error-handling)
+- [Handling Errors in Next.js](/docs/app/getting-started/error-handling)
- [Data Fetching in Next.js](/docs/app/getting-started/fetching-data)
If you continue to experience issues after trying these solutions, consider checking your server logs for more detailed error messages or reaching out to the Next.js community for support.