Next.js Discord

Discord Forum

⨯ useSearchParams() should be wrapped in a suspense boundary at page "/404".

Unanswered
Canada Goose posted this in #help-forum
Open in Discord
Canada GooseOP
hi how can I solve this error?

 ⨯ useSearchParams() should be wrapped in a suspense boundary at page "/404". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
    at a (/vercel/path0/build/server/chunks/165.js:25:27548)
    at d (/vercel/path0/build/server/chunks/165.js:15:98929)
    at l (/vercel/path0/build/server/chunks/365.js:1:29768)
    at nL (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:46773)
    at nF (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:48548)
    at nF (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:64360)
    at nq (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:67434)
    at nH (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:65009)
    at nV (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:70865)
    at nz (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:69548)
Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
Export encountered an error on /_not-found/page: /_not-found, exiting the build.
 ⨯ Next.js build worker exited with code: 1 and signal: null
Error: Command "npm run build" exited with 1

10 Replies

can you share code maybe and your folder structure screenshot like is the 404 page made by you or next generated?
@i_lost_to_loba_kreygasm can you share code maybe and your folder structure screenshot like is the 404 page made by you or next generated?
Canada GooseOP
Canada GooseOP
up
Canada GooseOP
up
up
Barbary Lion
Same issue but this is happening on all pages, not just 404 (not-found.tsx). I'm using "next": "15.2.4", and even the suggested config param doesnt fix it:
const nextConfig = {
  experimental: {
    missingSuspenseWithCSRBailout: false,
  },


EDIT:
The above suggestion is in the docs for version 15 (as in I've explicitly selected next.js 15 for which version of docs I want to view) and the suggestion to fix this issue is to add the above experimental prop... but it only works for next.js 14.
I'm not using useSearchParams() on these pages where errors are happening
Canada GooseOP
up
@Canada Goose hey find a solve?
Barbary Lion
Yes, research other platforms besides next.js 🤣. Not even sure what worked... but the error messages are a lot of false positives. Search for pages with usesearchparams and then fix each error that pops up. You'll need to try suspense comp, use client, and force dynamic.