vercel/next.js · error · StaticGenBailoutError
Route ${workStore.route} with `dynamic = "error"` couldn't b
Error message
Route ${workStore.route} with `dynamic = "error"` couldn't be rendered statically because it used `cookies()`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering What it means
Error "Route ${workStore.route} with `dynamic = "error"` couldn't be rendered statically because it used `cookies()`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering" thrown in vercel/next.js.
Source
Thrown at packages/next/src/server/request/cookies.ts:56
const workStore = workAsyncStorage.getStore()
const workUnitStore = workUnitAsyncStorage.getStore()
if (workStore) {
if (workUnitStore && !isRequestApiAllowedInCurrentPhase(workUnitStore)) {
throw new Error(
`Route ${workStore.route} used \`cookies()\` inside \`after()\` while rendering. This is not supported. If you need this data inside an \`after()\` callback, use \`cookies()\` outside of the callback. See more info here: https://nextjs.org/docs/app/api-reference/functions/after`
)
}
if (workStore.forceStatic) {
// When using forceStatic we override all other logic and always just return an empty
// cookies object without tracking
const underlyingCookies = createEmptyCookies()
return makeUntrackedCookies(underlyingCookies)
}
if (workStore.dynamicShouldError) {
throw new StaticGenBailoutError(
`Route ${workStore.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`cookies()\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`
)
}
if (workUnitStore) {
switch (workUnitStore.type) {
case 'cache':
const error = createCookiesInUseCacheError(workStore.route)
Error.captureStackTrace(error, cookies)
applyOwnerStack(error)
workStore.invalidDynamicUsageError ??= error
throw error
case 'unstable-cache':
throw createCookiesInUnstableCacheError(workStore.route)
case 'generate-static-params':
throw new Error(
`Route ${workStore.route} used \`cookies()\` inside \`generateStaticParams\`. This is not supported because \`generateStaticParams\` runs at build time without an HTTP request. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`
)View on GitHub (pinned to 258b1c1bc0)
Solutions
- Remove dynamic = "error" or stop using cookies() in the route.
Defensive patterns
Strategy: validation
When it happens
Trigger: cookies() is used in a route with dynamic = "error".
Common situations: A statically forced route reads cookies, which requires dynamic rendering.
AI-assisted analysis of vercel/next.js@258b1c1bc0 (2026-08-19).
Data as JSON: /api/errors/c6770ce059cb6e87.
Report an issue: GitHub.