{"record":{"id":"6eb3287c67e8c941","repo":"vercel/next.js","slug":"route-workstore-route-used-io-inside-after","errorCode":null,"errorMessage":"Route ${workStore.route} used `io()` inside `after()` while rendering. The `io()` function is not allowed in this scope. See more info here: https://nextjs.org/docs/app/api-reference/functions/after","messagePattern":"Route (.+?) used `io\\(\\)` inside `after\\(\\)` while rendering\\. The `io\\(\\)` function is not allowed in this scope\\. See more info here: https://nextjs\\.org/docs/app/api-reference/functions/after","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/server/request/io.ts","lineNumber":33,"sourceCode":"\n/**\n * This function allows you to indicate that the code following it performs\n * I/O or accesses dynamic data sources such as `new Date()` or `Math.random()`.\n *\n * During prerendering it will prevent the prerender from continuing past this\n * point, creating a dynamic boundary. Inside `\"use cache\"` scopes or during\n * a real request it resolves immediately.\n *\n * Unlike `connection()`, `io()` does not require an actual HTTP request and\n * can be used freely inside cache scopes and client components.\n */\nexport function io(): Promise<void> {\n  const workStore = workAsyncStorage.getStore()\n  const workUnitStore = workUnitAsyncStorage.getStore()\n\n  if (workStore && workUnitStore) {\n    if (workUnitStore && !isRequestApiAllowedInCurrentPhase(workUnitStore)) {\n      throw new Error(\n        `Route ${workStore.route} used \\`io()\\` inside \\`after()\\` while rendering. The \\`io()\\` function is not allowed in this scope. See more info here: https://nextjs.org/docs/app/api-reference/functions/after`\n      )\n    }\n    switch (workUnitStore.type) {\n      case 'request':\n        // For dev renders we instrument the promise so it will show up in\n        // React Suspense Devtools and, if also doing `instant` validation,\n        // ensure it resolves in the right stage for staged rendering\n        // In production we just let it resolve immediately because we're doing\n        // a dynamic SSR or resume render and have no need to delay anything\n        // after this call\n        if (process.env.NODE_ENV === 'development') {\n          if (workUnitStore.asyncApiPromises) {\n            return workUnitStore.asyncApiPromises.io\n          }\n          return makeDevtoolsIOAwarePromise(\n            undefined,\n            workUnitStore,","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/server/request/io.ts#L15-L51","documentation":"Error \"Route ${workStore.route} used `io()` inside `after()` while rendering. The `io()` function is not allowed in this scope. See more info here: https://nextjs.org/docs/app/api-reference/functions/after\" thrown in vercel/next.js.","triggerScenarios":"io() is called inside an after() callback.","commonSituations":"Using the io() API within unstable_after where it is disallowed.","solutions":["Do not call io() inside an after() callback; perform I/O before scheduling after()."],"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-14T00:17:10.932Z"}