Error: Dynamic server usage: Route /x couldn't be rendered statically because it used `cookies`
Next.js tried to statically render a route that reads request-specific data (cookies, headers, searchParams).
Seen on:
React
Meaning
During next build, routes are prerendered by default. Using cookies(), headers() or uncached fetches forces dynamic rendering; Next.js reports it when it can’t render statically.
Common causes
- cookies()/headers() in a page meant to be static
- fetch with cache: 'no-store' in a static route
- Catching the dynamic usage error in try/catch
⚡ Quick fix
- Mark the route dynamic: export const dynamic = 'force-dynamic'
- Move request-specific logic to client components or route handlers
- Don’t swallow Next.js internal errors in try/catch
Detailed fix by platform
React
export const dynamic = 'force-dynamic';
How to diagnose
- Route — Which route and API?
- Intent — Should it be static?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026