{"record":{"id":"4e92eed0c6d00a58","repo":"schollz/croc","slug":"this-browser-cannot-stream-a-file-this-large-rece","errorCode":null,"errorMessage":"This browser cannot stream a file this large. Receive it with the croc CLI instead.","messagePattern":"This browser cannot stream a file this large\\. Receive it with the croc CLI instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web/src/protocol/storage.ts","lineNumber":379,"sourceCode":"  ) {\n    throw new DOMException(\"Destination selection cancelled\", \"AbortError\");\n  }\n  return new DirectoryDestination(directory);\n}\n\nexport async function chooseStoredReceiveDestination(offer: TransferOffer) {\n  if (window.showDirectoryPicker) {\n    return chooseReceiveDestination(offer);\n  }\n  if (supportsStreamingDownloadDestination()) {\n    return new StreamingDownloadDestination();\n  }\n  const largest = offer.files.reduce(\n    (maximum, file) => Math.max(maximum, file.size),\n    0,\n  );\n  if (largest > 256 * 1024 * 1024) {\n    throw new Error(\n      \"This browser cannot stream a file this large. Receive it with the croc CLI instead.\",\n    );\n  }\n  return new DownloadDestination();\n}\n\nexport async function verifySink(sink: ReceiveSink, expected: Uint8Array) {\n  const actual = await sink.hash();\n  if (!bytesEqual(actual, expected)) {\n    throw new Error(\n      `The sender advertised xxhash ${hex(expected)}, but the received file hashes to ${hex(actual)}`,\n    );\n  }\n}\n\nexport async function verifySinkSHA256(\n  sink: ReceiveSink,\n  expected: Uint8Array,","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/schollz/croc/blob/e25f1bdc04f07f094d50b0a1bf67e2563944b57a/web/src/protocol/storage.ts#L361-L397","documentation":"Thrown by chooseStoredReceiveDestination when the browser has neither showDirectoryPicker (File System Access API) nor streaming-download support (service workers + MessageChannel + secure context), and the largest offered file exceeds 256 MiB. Without streaming, the fallback DownloadDestination buffers the entire file in memory as a Blob, which the code refuses to do for large files.","triggerScenarios":"offer.files max size > 256*1024*1024 AND window.showDirectoryPicker is undefined AND supportsStreamingDownloadDestination() is false (no serviceWorker, no MessageChannel, or insecure context on a non-localhost host).","commonSituations":"Firefox or Safari receiving a >256 MiB stored transfer; any browser serving the app over plain HTTP from a LAN IP or hostname (not a secure context, so no service worker registration); private-mode windows where service workers are disabled. The remedy is literally in the message: use the croc CLI receiver.","solutions":["Receive with the croc CLI using the CLI token (formatStoredCLIToken) instead of the browser","Serve the web app over HTTPS (or localhost) so supportsStreamingDownloadDestination() becomes true and streaming works","Use a Chromium-based browser where showDirectoryPicker is available regardless of size","Have the sender split the transfer into pieces under 256 MiB"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"import { supportsStreamingDownloadDestination, supportsDirectoryDestination } from \"../protocol/storage\";\nconst canBrowserReceive = (offer: TransferOffer): boolean =>\n  supportsDirectoryDestination() ||\n  supportsStreamingDownloadDestination() ||\n  offer.files.every((f) => f.size <= 256 * 1024 * 1024);","typeGuard":null,"tryCatchPattern":"try { return await chooseStoredReceiveDestination(offer); } catch (e) { if (e instanceof Error && e.message.includes(\"croc CLI\")) { showUseCLIPrompt(share); return null; } throw e; }","preventionTips":["Check capability flags (serviceWorker, secure context, showDirectoryPicker) before offering browser receive for large files","Always surface the croc CLI token alongside the browser link when files may exceed 256 MiB"],"tags":["browser-limit","memory","streaming","secure-context","large-file"],"backgroundTag":null,"analyzedSha":"e25f1bdc04f07f094d50b0a1bf67e2563944b57a","analyzedAt":"2026-08-15T12:53:39.096Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}