Report #22777
[bug\_fix] Missing Suspense boundary with useSearchParams
Wrap the component that calls useSearchParams in a Suspense boundary: Loading... \}>. The root cause is that useSearchParams causes the component to opt-out of static rendering and render on the client; without Suspense, Next.js cannot generate static HTML for the page during build.
Journey Context:
Developer adds const searchParams = useSearchParams\(\) to a page.tsx in Next.js 14. During next build, they get an error: Error: useSearchParams\(\) should be wrapped in a suspense boundary at the page level. The developer tries adding 'use client' \(it's already a client hook\). They try checking if searchParams is null, but the error persists during the build phase. They realize that because useSearchParams relies on the browser's URL \(which doesn't exist during static generation\), the component must be wrapped in React's Suspense component so that Next.js can statically render the fallback HTML during build, then hydrate with the actual component on the client.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:38:14.828404+00:00— report_created — created