Attachment downloads are broken for files over 500 MiB

(#600) Bug Open: Awaiting confirmation media self-hosting

Summary

When increasing attachment upload limits from the admin panel to over 500 MiB, you aren't able to download files over 500 MiB even if upload worked fine. When downloading files over 500 MiB, media-proxy throws an error and rejects the download:
media-proxy-1 | {"timestamp":"2026-06-16T19:44:41.879912Z","level":"WARN","fields":{"message":"request rejected","req":"NY8KF0BHZ0Q5","kind":"attachment","method":"GET","path":"/attachments/1516471820922912790/1516508361430925312/hannah_montana_linux_x86_basic_edition.iso","query":"download=true","status":413,"duration_ms":3,"fetch_ms":0,"transform_ms":0,"nsfw_ms":0,"reason":"storage_error","source":"\"key=attachments/1516471820922912790/1516508361430925312/hannah_montana_linux_x86_basic_edition.iso err=stream too long\""},"target":"fluxer_media_proxy::request_log"}
Seems to be because of a constant MAX_MEDIA_PROXY_BYTES

Steps to reproduce

  1. Increase upload limits to 2097152000 bytes.
  2. Upload a file that is over 500 MiB.
  3. Try to download the file.

Environment

Stable Web 2026.616.45607, Linux (x86), Chrome 149.0.0.0, Locale en-GB OS: Linux 7.0.12-1-cachyos (x64) Commit: fa3e8525755dae087c03ceaf83b814cbe46c7228

5 comments

Notice

The original media-proxy limit is fixed. The two reports below are separate bugs, now tracked in #4941 (desktop downloads over 512 MiB) and #4942 (uploads of 2 GB or more).
Sign in with Fluxer to comment and vote.
Comment by Rex
RexSystem 1 vote
Status changed from Needs triage to Awaiting confirmation
Fixed in the self-hosted media-proxy 2026.1011.113357: attachments over 500 MiB are streamed instead of buffered, so they download.
Comment by @cirogargatagli
RexSystem 1 vote edited originally by @cirogargatagli on GitHub
Same error for me. After investigating, I found that serve_stored_passthrough_stream() rejects any object whose size exceeds constants::MAX_MEDIA_PROXY_BYTES before attempting to stream it:
if head.content_length > constants::MAX_MEDIA_PROXY_BYTES as u64 {
    return storage_error_response(key, StorageError::StreamTooLong);
}
MAX_MEDIA_PROXY_BYTES is currently defined as:
pub const MAX_MEDIA_PROXY_BYTES: usize = 500 * 1024 * 1024;
Deleted comment
Removed by moderator Rex: Removed a general status note that was posted on many GitHub threads. It no longer applies here.
Comment by @brunorsvr
RexSystem 1 vote originally by @brunorsvr on GitHub
Hi! I would like to take this one I reproduced the issue locally and confirmed the 413 on attachment downloads over 500 MiB. The limit seems to be shared between the media processing path and streamed attachment downloads, so I’m planning to keep the cap for media processing while removing it from the streaming path Mind if I take this?
Comment by Fl4il
Fl4il 1 vote Still happening
today this is still happening. latest updates 8/11/2026 4:40 AM CEST To test I just bumped my "Max Attachment File Size" to 5GB uploaded a 1GB file. pressed download button. nothing seems to happen but. client logs : context: 'File download', hostname: '<domain_name>', error: 'Error: Download exceeds 536870912 bytes\n' + ' at IncomingMessage.<anonymous> (file:///opt/fluxer/resources/app.asar/dist/main/MainApp.js:13:77543)\n' + ' at IncomingMessage.emit (node:events:526:24)\n' + ' at addChunk (node:internal/streams/readable:569:12)\n' + ' at readableAddChunkPushByteMode (node:internal/streams/readable:520:3)\n' + ' at Readable.push (node:internal/streams/readable:400:5)\n' + ' at HTTPParser.parserOnBody (node:_http_common:137:24)\n' + ' at TLSSocket.socketOnData (node:_http_client:814:22)\n' + ' at TLSSocket.emit (node:events:514:28)\n' + ' at addChunk (node:internal/streams/readable:569:12)\n' + ' at readableAddChunkPushByteMode (node:internal/streams/readable:520:3)' server logs (seeweedfs) E1108 03:40:08.844883 s3api_object_handlers.go:1445 streamFromVolumeServers: streamFn failed after writing 558104576 bytes: write tcp 172.18.0.4:8333-&gt;172.18.0.12:37618: write: broken pipe E1108 03:40:08.844929 s3api_object_handlers.go:1135 GetObjectHandler: failed to stream fluxer/attachments/1562478376139096067/1568831675914256384/525359446.mp4 from volume servers: write tcp 172.18.0.4:8333-&gt;172.18.0.12:37618: write: broken pipe
Comment by Axle
Axle 1 vote Still happening
I'm running into the issue where when I set max_attachment_file_size to 4294967296 (4GB) and try to upload a file 2GB or larger it fails with "Attachment upload unavailable". When I upload a file of 1.9GB it works fine.