Next.js · next build (prerender)

Next.js encountered runtime / uncached data during prerendering (cacheComponents)

what it looks like
Error: Route "/dashboard": Next.js encountered uncached or runtime data during prerendering.

`fetch(...)`, `cookies()`, `headers()`, `params`, `searchParams`, or `connection()` accessed outside of `<Suspense>` prevents the route from being prerendered…

Ways to fix this:
  - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access
  - [cache] … `"use cache"`
  - [block] Set `export const instant = false` to allow a blocking route

What it means

With cacheComponents on (the Next.js 16 model), every route gets a prerendered shell. Reading cookies(), headers(), params, searchParams, auth() or an uncached database or fetch call outside <Suspense> would block that shell, so the build stops and lists three ways out.

Common causes

  • const session = await auth() at the top of a page
  • A database query in a page with no "use cache" and no <Suspense>
  • Reading searchParams in a layout

How to fix it

  1. [stream] Move the data access into a child component and wrap it in <Suspense fallback={…}>
  2. [cache] Add "use cache" to data that's the same for every visitor (not for cookies or auth)
  3. [block] For fully per-user pages like a dashboard, add export const instant = false
src/app/dashboard/page.tsx
import { Suspense } from "react";

export default function Page() {
  return (
    <Suspense fallback={<p>Loading…</p>}>
      <Account /> {/* awaits auth() and the DB inside */}
    </Suspense>
  );
}

// or, for a page that is per-user anyway:
// export const instant = false;

works with Next.js 16.4.3 · React 19.3last verified

prevent it · nextjs-app-router.mdc (free Cursor Rules Pack): With cacheComponents on, request-time data (cookies, session, per-user queries) goes inside <Suspense>.

Prompt for Cursor or Claude Code

next build fails because a route reads runtime or uncached data outside <Suspense> (cacheComponents is on). For this route, move the cookies/auth/DB access into a child component wrapped in <Suspense>, or add "use cache" if the data is the same for everyone, or export const instant = false if the page is fully per-user. Explain which one you picked.

Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Next.js error fixer.

next: skip the next one

Skip the debugging. The VibeBoot SaaS Starter ships with this already handled: it follows the Next.js 16 conventions (src/proxy.ts, Server Components by default, request-time data in <Suspense>) and its AGENTS.md and .cursor/rules keep your agent on them. Plus auth, Stripe and a database on Next.js 16.4.3. $49, one-time.

14-day money-back guarantee · lifetime updates

$ fixed it? get the next one first

New fixes for what AI agents break, by email.

When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.

Subscribe free