---
source: https://iinventedlight.com/library/notes/react-error-boundaries.md
title: "Catch render errors with a React error boundary or Next.js error handling"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (React docs); MIT (Next.js docs); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: React docs, Component; Next.js docs, Error Handling. CC-BY-4.0; MIT."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: React error boundaries and Next.js errors"
tags: [react, error-boundary, nextjs, errors]
client: Librarian
sources:
  - id: S1
    title: "Component"
    publisher: React docs
    url: https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary
    accessed: 2026-11-19
    license: "CC-BY-4.0"
  - id: S2
    title: "Error Handling"
    publisher: Next.js docs
    url: https://nextjs.org/docs/app/getting-started/error-handling
    accessed: 2026-11-19
    license: "MIT"
---
# Catch render errors with a React error boundary or Next.js error handling
**Answer:** A render error can cause React to remove its UI from the screen. You can display fallback UI for the part that crashed by wrapping it in an Error Boundary. Next.js divides errors into expected errors and uncaught exceptions.

## What an Error Boundary catches

An Error Boundary wraps part of the UI and can show fallback UI, for example an error message. Error boundaries do not catch errors for event handlers, server side rendering, errors thrown in the error boundary itself, or asynchronous code such as `setTimeout`. Class components still provide this with `getDerivedStateFromError` and `componentDidCatch`.

## Expected errors in Next.js

Expected errors can occur during normal operation, including failed requests. They should be returned to the client. For Server Functions, the Next.js page shows `useActionState` to handle those expected errors. Avoid `try`/`catch` and thrown errors for that case; model expected errors as return values.

| Error Boundary | Next.js |
|---|---|
| fallback UI | Displayed instead of the part that crashed |
| event handlers | Not caught by an Error Boundary |
| expected errors | Handled explicitly and returned to the client |
| useActionState | Hook shown for expected errors in Server Functions |

## See also

- [nextjs-error-handling](https://iinventedlight.com/library/notes/nextjs-error-handling/)
- [nextjs-not-found](https://iinventedlight.com/library/notes/nextjs-not-found/)
- [react-components-basics](https://iinventedlight.com/library/notes/react-components-basics/)

## Claims

- id: C1
  claim: An Error Boundary can display fallback UI instead of the part of the tree that crashed.
  source: S1
  evidence: "display some fallback UI instead of the part that crashed"

- id: C2
  claim: Error boundaries do not catch errors in event handlers or several other cases.
  source: S1
  evidence: "Error boundaries do not catch errors for"

- id: C3
  claim: Next.js divides errors into expected errors and uncaught exceptions.
  source: S2
  evidence: "expected errors and uncaught exceptions"

## Sources

- [S1] Component. React docs. https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary . License: CC-BY-4.0. Accessed 2026-11-19.

- [S2] Error Handling. Next.js docs. https://nextjs.org/docs/app/getting-started/error-handling . License: MIT. Accessed 2026-11-19.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: React docs, Component; Next.js docs, Error Handling. CC-BY-4.0; MIT. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
