{"record":{"id":"1ef601c3f553eab2","repo":"vercel/next.js","slug":"saving-heap-snapshot-to-heapfilename-note-th","errorCode":null,"errorMessage":"Saving heap snapshot to ${heapFilename}.  Note: this will take some time.","messagePattern":"Saving heap snapshot to (.+?)\\.  Note: this will take some time\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/memory/trace.ts","lineNumber":109,"sourceCode":"    info(` - Percentage Heap Used: ${percentageHeapUsed.toFixed(2)}%`)\n    info('***************************************')\n    info('')\n\n    if (percentageHeapUsed > HEAP_SNAPSHOT_THRESHOLD_PERCENT) {\n      const distDir = traceGlobals.get('distDir')\n      const heapFilename = join(\n        distDir,\n        `${description.replace(' ', '-')}.heapsnapshot`\n      )\n      warn(\n        bold(\n          `Heap usage is close to the limit. ${percentageHeapUsed.toFixed(\n            2\n          )}% of heap has been used.`\n        )\n      )\n      if (!alreadyGeneratedHeapSnapshot) {\n        warn(\n          bold(\n            `Saving heap snapshot to ${heapFilename}.  ${italic(\n              'Note: this will take some time.'\n            )}`\n          )\n        )\n        v8.writeHeapSnapshot(heapFilename)\n        alreadyGeneratedHeapSnapshot = true\n      } else {\n        warn(\n          'Skipping heap snapshot generation since heap snapshot has already been generated.'\n        )\n      }\n    }\n  }\n}\n","sourceCodeStart":91,"sourceCodeEnd":126,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/lib/memory/trace.ts#L91-L126","documentation":"traceMemoryUsage warns the first time heap usage crosses the threshold that it is synchronously writing a V8 heap snapshot to distDir/<description>.heapsnapshot; the note about timing exists because snapshot writing can take a while on large heaps.","triggerScenarios":"Thrown at packages/next/src/lib/memory/trace.ts:109 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait while the heap snapshot is written to disk, then analyze it with Chrome DevTools or similar."],"exampleFix":null,"handlingStrategy":"fallback","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"}