# Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error. (Next.js)

Seen in the browser console and in error.tsx boundaries of a production App Router build. React swaps the server-side message for this generic text plus a digest hash (Next.js 16 builds show Minified React error #441, which links to the same text); the original error and stack are printed only in the server's own output.

```
Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.
    at sk (https://example.com/_next/static/chunks/4bd1b696-a1b2c3d4e5f6a7b8.js:1:110223)
    at nU (https://example.com/_next/static/chunks/4bd1b696-a1b2c3d4e5f6a7b8.js:1:121101)
  digest: '2810573849'

Server output from next start for the same request:
 ⨯ Error: connect ECONNREFUSED 10.0.3.12:5432
    at async getProjects (.next/server/app/dashboard/page.js:1:4021) {
  digest: '2810573849'
}
```

## Quick fix

Copy the digest from the browser error and search your server logs for it: next start prints the original error with the same digest. To stop hunting through logs, export onRequestError from instrumentation.ts and send every server render, route handler and server action error, with its digest and route, to an error tracker.

1. Copy the digest (error.digest in error.tsx, or from the browser console).
2. Search server output for it: pm2 logs, docker logs, or your host's function logs.
3. Read the original message and stack printed next to that digest.
4. Reproduce locally with next build and next start if dev mode doesn't show it.
5. Export onRequestError from instrumentation.ts to report server errors with route context.
6. Render error.digest in error.tsx so users can quote it to support.

```ts
// instrumentation.ts (project root, or src/ if you use it)
import type { Instrumentation } from 'next';

export const onRequestError: Instrumentation.onRequestError = async (err, request, context) => {
  const e = err as Error & { digest?: string };
  // Replace console.error with your error tracker's capture call
  console.error('[server error]', {
    digest: e.digest,
    message: e.message,
    stack: e.stack,
    path: request.path,
    route: context.routePath,
    kind: context.routeType, // 'render' | 'route' | 'action' | 'proxy'
  });
};
```

## Why it happens

### A data call failed during render

A database query, an internal API fetch or an SDK call threw inside an async Server Component: bad credentials, a timeout, a row the code assumed existed. The real message stays on the server while the browser gets the generic one.

### Environment variable missing at runtime

Values present in development or at build time are absent from the production runtime, so a client constructor throws on the first request. NEXT_PUBLIC_ variables are inlined at build, while server-only variables are read when the code runs.

### Props that cannot cross to a Client Component

Passing class instances, functions other than server actions, or other non-serializable values from a Server Component to a Client Component fails. Development names the offending prop; production shows only this message.

### Browser APIs used on the server

Code that touches window, document or localStorage runs in a Server Component and throws a ReferenceError there. In a client component the same error stays in the server log and the browser renders that part itself, so this message does not appear.

### Errors thrown from server actions

Exceptions inside a server action reach the client with the same sanitized message. Expected failures such as validation or permission problems should be returned as values so the UI can show them.

## Other fixes

- Add error.tsx boundaries per route segment so one failing component does not take down the whole page.
- Return expected failures from server actions as data ({ ok: false, message }) instead of throwing.
- Validate required environment variables at startup so a missing secret fails the deploy, not the first request.
- Move browser API access into useEffect, or load that component with next/dynamic and ssr: false.

## Same error, other wording

- `Application error: a server-side exception has occurred (see the server logs for more information). Digest: 2810573849`
- `Error: An error occurred in the Server Components render.`
- `Minified React error #441; visit https://react.dev/errors/441 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`
- `Application error: a server-side exception has occurred while loading example.com (see the server logs for more information). Digest: 2810573849`

## Sources

- [Next.js: instrumentation.js (onRequestError)](https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation)
- [Next.js: error.js file convention](https://nextjs.org/docs/app/api-reference/file-conventions/error)
- [Next.js: Error handling](https://nextjs.org/docs/app/getting-started/error-handling)

---

To see this error the next time it happens in production, with the stack trace and the steps before it: Runheed records it and serves it to your coding agent over MCP. Setup instructions an agent can follow: https://runheed.com/SETUP.txt

Human-readable version: https://runheed.com/errors/server-components-render-error
