{"record":{"id":"3a370ea97064f29f","repo":"vercel/next.js","slug":"route-workstore-route-with-dynamic-error-3a370e","errorCode":null,"errorMessage":"Route ${workStore.route} with `dynamic = \"error\"` couldn't be rendered statically because it used `${expression}`. 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 `(.+?)`\\. 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/draft-mode.ts","lineNumber":208,"sourceCode":"      `Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`\n  )\n}\n\nfunction trackDynamicDraftMode(expression: string, constructorOpt: Function) {\n  const workStore = workAsyncStorage.getStore()\n  const workUnitStore = workUnitAsyncStorage.getStore()\n\n  if (workStore) {\n    // We have a store we want to track dynamic data access to ensure we\n    // don't statically generate routes that manipulate draft mode.\n    if (workUnitStore?.phase === 'after') {\n      throw new Error(\n        `Route ${workStore.route} used \"${expression}\" inside \\`after()\\`. The enabled status of \\`draftMode()\\` can be read inside \\`after()\\` but you cannot enable or disable \\`draftMode()\\`. See more info here: https://nextjs.org/docs/app/api-reference/functions/after`\n      )\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 \\`${expression}\\`. 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        case 'private-cache': {\n          const error = createDraftModeMutationInUseCacheError(\n            workStore.route,\n            expression\n          )\n          Error.captureStackTrace(error, constructorOpt)\n          applyOwnerStack(error)\n          workStore.invalidDynamicUsageError ??= error\n          throw error\n        }\n        case 'unstable-cache':","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/vercel/next.js/blob/258b1c1bc05f7099816b88f70b7b3422b24a4b8d/packages/next/src/server/request/draft-mode.ts#L190-L226","documentation":"Error \"Route ${workStore.route} with `dynamic = \"error\"` couldn't be rendered statically because it used `${expression}`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering\" thrown in vercel/next.js.","triggerScenarios":"draftMode() is used in a route with dynamic = \"error\".","commonSituations":"A statically forced route accesses draftMode, which requires dynamic rendering.","solutions":["Remove dynamic = \"error\" or stop using draftMode() 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"}