{"record":{"id":"0201926fe189fd8d","repo":"vercel/next.js","slug":"route-workstore-route-used-connection-insid","errorCode":null,"errorMessage":"Route ${workStore.route} used `connection()` 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 `connection\\(\\)` 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/connection.ts","lineNumber":76,"sourceCode":"          Error.captureStackTrace(error, connection)\n          applyOwnerStack(error)\n          workStore.invalidDynamicUsageError ??= error\n          throw error\n        }\n        case 'private-cache': {\n          // It might not be intuitive to throw for private caches as well, but\n          // we don't consider runtime prefetches as \"actual requests\" (in the\n          // navigation sense), despite allowing them to read cookies.\n          const error = createConnectionInPrivateUseCacheError(workStore.route)\n          Error.captureStackTrace(error, connection)\n          applyOwnerStack(error)\n          workStore.invalidDynamicUsageError ??= error\n          throw error\n        }\n        case 'unstable-cache':\n          throw createConnectionInUnstableCacheError(workStore.route)\n        case 'generate-static-params':\n          throw new Error(\n            `Route ${workStore.route} used \\`connection()\\` 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        case 'prerender-client':\n        case 'prerender-runtime':\n          // We return a promise that never resolves to allow the prerender to\n          // stall at this point.\n          return makeDynamicHangingPromise(\n            workUnitStore.renderSignal,\n            workStore.route,\n            '`connection()`'\n          )\n        case 'validation-client': {\n          // TODO(NAR-789): make this consistent with the actual browser behavior when we change it.\n          // Until then, erroring is fine.\n          const exportName = '`connection`'\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.`","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/vercel/next.js/blob/258b1c1bc05f7099816b88f70b7b3422b24a4b8d/packages/next/src/server/request/connection.ts#L58-L94","documentation":"Error \"Route ${workStore.route} used `connection()` 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":"connection() is called inside generateStaticParams.","commonSituations":"Using the connection() dynamic API at build time inside generateStaticParams.","solutions":["Do not call connection() inside generateStaticParams; it runs at build time without a request."],"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"}