Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: A download from the desktop Browser can go missing from Downloads #47365

ClosedJohanesPeterV(GitHub profile, opens in a new tab) opened this issue 0 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

  1. Put 30 copies of a small PDF in Downloads, invoice.pdf to invoice (29).pdf:

    cd ~/Downloads && printf '%%PDF-1.4\n' > invoice.pdf && for i in $(seq 1 29); do cp invoice.pdf "invoice ($i).pdf"; done
  2. Serve a page with an attachment named invoice.pdf:

    node -e 'require("http").createServer((req, res) => req.url === "/invoice" ? (res.writeHead(200, { "content-type": "application/pdf", "content-disposition": "attachment; filename=invoice.pdf" }), res.end("%PDF-1.4\n")) : res.end("<a href=/invoice>Download invoice</a>")).listen(8123)'
  3. Ask the agent to open http://127.0.0.1:8123 in the built-in Browser.

  4. Wait 5 seconds after the agent's last action, so the click counts as yours, then click Download invoice.

Expected behavior

invoice (30).pdf shows up in Downloads.

Actual behavior

Nothing shows up in Downloads, most of the time. The desktop log has preview download copy failed with ENOENT, so the shared file was already gone when the desktop tried to copy it. The agent's copy on the server is fine.

Looks like a race. The server's saveDownload saves the agent's copy, then calls download.delete() on the shared file (since #18435). The desktop copies that same file into Downloads, and checks each invoice (n).pdf name first, so same-name files give the delete time to win.

I first hit this with a normal download, no same-name files. That was rare. Same-name files make it happen most of the time.

Impact

Minor bug or occasional failure

Version or commit

main at 89ba000739

Environment

macOS 26.5.1, desktop app, Electron 44.10.1. Same on Linux (Debian 13 arm64, Electron 44.10.1 under Xvfb).

Logs or stack traces

preview download copy failed
ENOENT: no such file or directory, copyfile

Screenshots, recordings, or supporting files

before.mp4

Workaround

No response

  1. JohanesPeterV(GitHub profile, opens in a new tab) added labelsneeds-triage

  2. juliusmarminge closed this

Sign in to join this conversation.