Report #87705
[bug\_fix] Error: useSearchParams\(\) should be wrapped in a suspense boundary at page level
Wrap the component consuming useSearchParams in a React Suspense boundary with a fallback UI. Alternatively, mark the page with export const dynamic = 'force-dynamic' to opt out of static generation.
Journey Context:
Developer creates a search results page in Next.js App Router using const searchParams = useSearchParams\(\) to read URL query parameters. Works perfectly in next dev, but running next build fails with cryptic error about missing Suspense boundary. Developer attempts to extract the logic into a separate client component, but error persists because the static generation phase attempts to access search params which don't exist during build time. After reading the error trace and consulting Next.js documentation, discovers that useSearchParams triggers client-side rendering bailout, requiring a Suspense boundary to show fallback during static generation. Wraps the search component in \}>, resolving the build error and allowing static generation of shell with client-side hydration of search params.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:47:59.273536+00:00— report_created — created