Bulk upload keeps uploading every file after the session is gone, without telling the user

Open
#19,724 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@leon-wbr is already working on this.

Since Nov 18, 2026.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale

Research direction

Start with the bulk upload flow in FormsManager and the e2e cases in test/uploads/e2e.spec.ts at lines 2275–2359. Run the tests for 401, 403, and 403 without a JSON body to see how the queue handles each response. Done means the first 401 or 403 stops uploads, leaves unsent files in the drawer, and shows one error; linked pull request #19725 is already open.

Written by the indexing model from the issue text.

Description

Bug Payload OSS
Describe the Bug

In the admin bulk upload (FormsManager), if the auth cookie disappears mid-queue (here the browser dropped it; a server-side session revoke or expiry does the same), every remaining POST /api/{upload collection} returns 403 You are not allowed to perform this action. The bulk uploader shows that per-file toast and moves on to the next file. Each request still sends the whole file body before being refused, so a 34-file queue of 15–25 MB photos spent 22 minutes uploading ~600 MB that was all rejected. The user saw "Uploading 33 of 34" and a stream of identical errors, with no hint that signing in again would fix it.

Expected: on the first 401 or 403, stop the queue, keep the unsent files in the drawer and show the error once, so the user can sign in again and press Save for the rest.

Related: #18161 (a rejected request or non-JSON error response is swallowed and the file is counted as saved).

Six files queued; after the first upload the server answers 403 and every remaining file is still sent, one toast each

Link to the code that reproduces this issue

https://github.com/leon-wbr/payload/blob/7b0eb06864c009815e9a7f25cf1adaad4a260a88/test/uploads/e2e.spec.ts#L2275-L2359

Reproduction Steps

The linked e2e tests reproduce it in Payload's own test/uploads suite ("bulk uploads › on a 401 or 403 › should stop uploading and keep the remaining files on a 401" / "… on a 403" / "… on a 403 without a JSON body"). Against main (without the fix in the linked branch) all three fail: with a JSON error the toast appears once per remaining file instead of once, and with an HTML body the refused files are counted as saved.

Manually:

  1. Sign in to the admin and open any upload collection.
  2. Bulk upload several files (larger files make it obvious).
  3. While the queue runs, sign out in another tab (or delete the payload-token cookie).
  4. Every remaining file is still uploaded in full and refused with 403, one toast per file; the queue never stops.
Which area(s) are affected? (Select all that apply)

area: ui

Environment Info
Payload: 3.92.1 and 3.93.0 (FormsManager is identical in both and on main)
Node.js: 24.22.1
Next.js: 16.4.6
Database: d1-sqlite, on Cloudflare Workers (reproduced with sqlite in Payload's test suite)
Browser: Chrome
Dominant language
TypeScript
Stars
45.8k
Forks
4.4k
Avg merge
2d 16h
Merged PRs (30d)
251

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from payloadcms/payload

All issues in payloadcms/payload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.