Skip to content

Attachments stop at 8 MB; a larger file needs a higher limit or another upload path #445

Closed

Description

@devswha

What happens

A file attached in the composer, or pasted or dropped on the terminal, is refused above 8 MB: MAX_IMAGE_BYTES in server/paste.ts, answered as 413 image_too_large. The comment beside the number explains it by screenshots ("screenshots land in the 0.1-2MB range; 8MB leaves headroom"), but the route now stores any kind of file under its own name, so the limit is met by ordinary files: an archive, a PDF, a recording.

A 107 MB zip showed only /api/pane/image failed (413):, with no reason after the colon. That answer did not come from the route:

  • The upload is the whole file as base64 inside a JSON body, about 4/3 of the file's size.
  • The server sets no maxRequestBodySize, so Bun's default of 128 MB applies, and Bun answers 413 with an empty body before the route runs.

Measured on Bun 1.4.2 with a scratch server and the same body shape: a 90 MB file (120.0 MB body) reached the handler; a 107 MB file (142.7 MB body) got 413 with an empty body and the handler was never called.

A separate PR makes the browser check the size before it uploads and say what the limit is. This issue is about the limit itself.

Options

  1. Raise the number and keep the transport. Every upload is read whole in the browser, encoded, parsed as JSON on the server and decoded again, so the file sits in memory several times on both sides. That is fine for some tens of MB. A file of about 96 MB is the ceiling whatever the number says, unless maxRequestBodySize is raised with it.
  2. A streaming upload: the bytes as the request body (or multipart) to a route that writes them to disk as they arrive. That removes the ceiling and the copies. It is a new route, so it needs a contract test, an answer in the demo transport, an entry in the remote-PC proxy's allowlist, and probably progress and cancel in the composer.
  3. Keep 8 MB and say so in the guide.

To decide

  • How large a file should be attachable. The case that raised this was a 107 MB zip.
  • Whether a remote PC gets the same limit: there the upload goes through the connection server and its bridge.

Activity

  1. devswha commented on Oct 5, 2026

    @devswha
    OwnerAuthor

    The size check before the upload, and its message, are in #446.

  2. added a commit that references this issue on Oct 14, 2026
    67cb7b3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions