{"record":{"id":"2c4fed8261753778","repo":"vercel/next.js","slug":"route-workstore-route-used-expression-insi-2c4fed","errorCode":null,"errorMessage":"Route ${workStore.route} used \"${expression}\" inside a function cached with `unstable_cache()`. The enabled status of `draftMode()` can be read in caches but you must not enable or disable `draftMode()` inside a cache. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache","messagePattern":"Route (.+?) used \"(.+?)\" inside a function cached with `unstable_cache\\(\\)`\\. The enabled status of `draftMode\\(\\)` can be read in caches but you must not enable or disable `draftMode\\(\\)` inside a cache\\. See more info here: https://nextjs\\.org/docs/app/api-reference/functions/unstable_cache","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/server/request/draft-mode.ts","lineNumber":222,"sourceCode":"      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 = new Error(\n            `Route ${workStore.route} used \"${expression}\" inside \"use cache\". The enabled status of \\`draftMode()\\` can be read in caches but you must not enable or disable \\`draftMode()\\` inside a cache. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`\n          )\n          Error.captureStackTrace(error, constructorOpt)\n          applyOwnerStack(error)\n          workStore.invalidDynamicUsageError ??= error\n          throw error\n        }\n        case 'unstable-cache':\n          throw new Error(\n            `Route ${workStore.route} used \"${expression}\" inside a function cached with \\`unstable_cache()\\`. The enabled status of \\`draftMode()\\` can be read in caches but you must not enable or disable \\`draftMode()\\` inside a cache. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`\n          )\n\n        case 'prerender':\n        case 'prerender-runtime': {\n          const error = new Error(\n            `Route ${workStore.route} used ${expression} without first calling \\`await connection()\\`. See more info here: https://nextjs.org/docs/messages/next-prerender-sync-headers`\n          )\n          return abortAndThrowOnSynchronousRequestDataAccess(\n            workStore.route,\n            expression,\n            error,\n            workUnitStore\n          )\n        }\n        case 'prerender-client':\n        case 'validation-client':\n          const exportName = '`draftMode`'","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/server/request/draft-mode.ts#L204-L240","documentation":"Error \"Route ${workStore.route} used \"${expression}\" inside a function cached with `unstable_cache()`. The enabled status of `draftMode()` can be read in caches but you must not enable or disable `draftMode()` inside a cache. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache\" thrown in vercel/next.js.","triggerScenarios":"draftMode enable/disable is called inside unstable_cache.","commonSituations":"Mutating draft mode inside a cached function; only reading the enabled status is allowed.","solutions":["Do not enable/disable draftMode() inside unstable_cache; read isEnabled only, or move mutation outside the cache."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}