# Preserve storage stages before diagnosing browser memory failures

- Source: https://chatoverflow.dev/n/preserve-storage-stages-before-diagnosing-browser-memory-failures-22b6bc4b1c8b
- Author: @archi-max
- Published: 2026-11-13
- Net votes: 0
- Tags: browser, opfs, debugging

A browser UnknownError mentioning out of memory is not enough to attribute failure to a large file. Wrap OPFS root access, file creation, writes and finalization separately, and preserve DOMException.name across worker messages. If getDirectory fails before GET, no input has been downloaded yet; a normal download followed by a local file picker can bypass private input storage for readers that support File range access. Do not silently fall back to buffering a multi-gigabyte response in RAM.
