{"record":{"id":"fd6bb78834275c98","repo":"vercel/next.js","slug":"you-should-not-access-res-after-getserversidepro","errorCode":null,"errorMessage":"You should not access 'res' after getServerSideProps resolves.\nRead more: https://nextjs.org/docs/messages/gssp-no-mutating-res","messagePattern":"You should not access 'res' after getServerSideProps resolves\\.\nRead more: https://nextjs\\.org/docs/messages/gssp-no-mutating-res","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/server/render.tsx","lineNumber":1081,"sourceCode":"    props[SERVER_PROPS_ID] = true\n  }\n\n  if (getServerSideProps && !isFallback) {\n    let data: UnwrapPromise<ReturnType<GetServerSideProps>>\n\n    let canAccessRes = true\n    let resOrProxy = res\n    let deferredContent = false\n    if (process.env.NODE_ENV !== 'production') {\n      resOrProxy = new Proxy<ServerResponse>(res, {\n        get: function (obj, prop) {\n          if (!canAccessRes) {\n            const message =\n              `You should not access 'res' after getServerSideProps resolves.` +\n              `\\nRead more: https://nextjs.org/docs/messages/gssp-no-mutating-res`\n\n            if (deferredContent) {\n              throw new Error(message)\n            } else {\n              warn(message)\n            }\n          }\n\n          if (typeof prop === 'symbol') {\n            return ReflectAdapter.get(obj, prop, res)\n          }\n\n          return ReflectAdapter.get(obj, prop, res)\n        },\n      })\n    }\n\n    try {\n      data = await getTracer().trace(\n        RenderSpan.getServerSideProps,\n        {","sourceCodeStart":1063,"sourceCodeEnd":1099,"githubUrl":"https://github.com/vercel/next.js/blob/89d017eac43ebf4742ed2b58d3c1373b70283b69/packages/next/src/server/render.tsx#L1063-L1099","documentation":"Development-only runtime guard: while getServerSideProps is awaited, renderToHTMLImpl wraps res in a Proxy whose get trap flips canAccessRes to false once the promise settles. Any later property access on res inside the same render hits the trap and throws this error, catching user code that mutates the response (headers, statusCode) after getServerSideProps has already resolved.","triggerScenarios":"Thrown at packages/next/src/server/render.tsx:1083 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not write to `res` after getServerSideProps resolves; return values via the result object instead.","Move any `res.setHeader`/`res.end` calls before returning from getServerSideProps."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"89d017eac43ebf4742ed2b58d3c1373b70283b69","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}