{"record":{"id":"c6770ce059cb6e87","repo":"vercel/next.js","slug":"route-workstore-route-with-dynamic-error","errorCode":null,"errorMessage":"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","messagePattern":"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","errorType":"exception","errorClass":"StaticGenBailoutError","httpStatus":null,"severity":"error","filePath":"packages/next/src/server/request/cookies.ts","lineNumber":56,"sourceCode":"  const workStore = workAsyncStorage.getStore()\n  const workUnitStore = workUnitAsyncStorage.getStore()\n\n  if (workStore) {\n    if (workUnitStore && !isRequestApiAllowedInCurrentPhase(workUnitStore)) {\n      throw new Error(\n        `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`\n      )\n    }\n\n    if (workStore.forceStatic) {\n      // When using forceStatic we override all other logic and always just return an empty\n      // cookies object without tracking\n      const underlyingCookies = createEmptyCookies()\n      return makeUntrackedCookies(underlyingCookies)\n    }\n\n    if (workStore.dynamicShouldError) {\n      throw new StaticGenBailoutError(\n        `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`\n      )\n    }\n\n    if (workUnitStore) {\n      switch (workUnitStore.type) {\n        case 'cache':\n          const error = createCookiesInUseCacheError(workStore.route)\n          Error.captureStackTrace(error, cookies)\n          applyOwnerStack(error)\n          workStore.invalidDynamicUsageError ??= error\n          throw error\n        case 'unstable-cache':\n          throw createCookiesInUnstableCacheError(workStore.route)\n        case 'generate-static-params':\n          throw new Error(\n            `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`\n          )","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/vercel/next.js/blob/258b1c1bc05f7099816b88f70b7b3422b24a4b8d/packages/next/src/server/request/cookies.ts#L38-L74","documentation":"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.","triggerScenarios":"cookies() is used in a route with dynamic = \"error\".","commonSituations":"A statically forced route reads cookies, which requires dynamic rendering.","solutions":["Remove dynamic = \"error\" or stop using cookies() in the route."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"258b1c1bc05f7099816b88f70b7b3422b24a4b8d","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}