Next.js · next build (prerender)

useSearchParams() should be wrapped in a suspense boundary

what it looks like
⨯ useSearchParams() should be wrapped in a suspense boundary at page "/login". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
Error occurred prerendering page "/login".

What it means

A Client Component reads the URL query with useSearchParams on a page Next.js prerenders. The query isn't known at build time, so Next.js needs a <Suspense> boundary to render a fallback there. next dev doesn't complain; next build does.

Common causes

  • A login or search page reads ?error= or ?q= with useSearchParams
  • The hook sits in a component used in layout.tsx, so every page fails

How to fix it

  1. Wrap the component that calls useSearchParams in <Suspense> in its parent
  2. Or read searchParams in the page (a Server Component prop) and pass the value down
src/app/login/page.tsx
import { Suspense } from "react";
import { LoginForm } from "./login-form"; // calls useSearchParams()

export default function Page() {
  return (
    <Suspense fallback={null}>
      <LoginForm />
    </Suspense>
  );
}

works with Next.js 16.4.3 · React 19.3last verified

Prompt for Cursor or Claude Code

next build fails: useSearchParams() should be wrapped in a suspense boundary. Find every component that calls useSearchParams and wrap where it's rendered in <Suspense> with a sensible fallback. Don't make the whole page dynamic to work around it.

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