Course map
Stage 1: App Router Foundations
Stage 2: The Rendering Model
Stage 3: Data, Caching and Mutations
Stage 4: Full-Stack Next.js
Stage 5: Production and Specialization

Part 07 / Topic 7 of 7

What happens when a boundary's content throws

A component streaming behind a <Suspense> boundary can fail after the response has already started — the HTTP status is already 200, committed with the first chunk, and cannot be changed. Reproduced for real with a throwaway route, one slow component that always throws after 300ms, and a sibling error.tsx:

async function Flaky(): Promise<ReactNode> {
  await wait(300);
  throw new Error("Upstream ops feed timed out");
}
"use client"; // error.tsx is always a Client Component — Part 6's boundary applies here too

export default function Error({ error }: { error: Error & { digest?: string } }) {
  return <p id="error-ui">Could not load this widget: {error.message}</p>;
}

The response, read in full against a production (next start) build:

$ curl -sD - http://localhost:PORT/ops/error-demo
HTTP/1.1 200 OK

Two things confirmed directly in that response, neither obvious from the code alone: the paragraph above the failing widget survives untouched — only the one Suspense boundary that errored gets replaced — and the raw string "Upstream ops feed timed out" never appears anywhere in the HTML. In its place, the stream carries only d:E{"digest":"961092803"} (varies) — a hashed reference, not the message. This is the installed package's own documented behavior for a production build: server error details are hidden from the client, and only a digest that links back to server logs is sent. error.tsx's own rendered text (#error-ui) never appears in the server-sent HTML at all in this case, because error.tsx must be a Client Component — its fallback UI is a client-side DOM swap that happens after hydration, which curl can never see; only a real browser (or a headless one) renders it.

Done here? The practice set for Part 7 — including the solutions — is on the part page.

Search the guide