{"record":{"id":"c2c35e6c4b061a11","repo":"vercel/next.js","slug":"route-workstore-route-used-cookies-inside-c2c35e","errorCode":null,"errorMessage":"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","messagePattern":"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","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/server/request/cookies.ts","lineNumber":72,"sourceCode":"\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          )\n        case 'prerender':\n          return makeHangingCookies(workStore, workUnitStore)\n        case 'prerender-client':\n        case 'validation-client':\n          const exportName = '`cookies`'\n          throw new InvariantError(\n            `${exportName} must not be used within a Client Component. Next.js should be preventing ${exportName} from being included in Client Components statically, but did not in this case.`\n          )\n        case 'prerender-legacy':\n          // We track dynamic access here so we don't need to wrap the cookies\n          // in individual property access tracking.\n          return throwToInterruptStaticGeneration(\n            callingExpression,\n            workStore,\n            workUnitStore\n          )","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/vercel/next.js/blob/258b1c1bc05f7099816b88f70b7b3422b24a4b8d/packages/next/src/server/request/cookies.ts#L54-L90","documentation":"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\" thrown in vercel/next.js.","triggerScenarios":"cookies() is called inside generateStaticParams.","commonSituations":"Using cookies at build time inside generateStaticParams where no request exists.","solutions":["Do not call cookies() inside generateStaticParams; use params passed to it instead."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"258b1c1bc05f7099816b88f70b7b3422b24a4b8d","analyzedAt":"2026-09-01T03:35:59.642Z","contentChangedAt":"2026-09-01T03:35:59.642Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}