Handling Duplicate File Uploads with Custom Error Code 454 in Uppy

I’ve implemented the code to prevent duplicate files from being uploaded by returning a custom error code 454. This part works fine, and the error is correctly detected.

However, the issue I’m facing is with how this error is displayed in the console. Currently, it appears as a red error message in the uppy control, which isn’t ideal since I want to handle this specific error (454) as a successful upload. Here is the console output I’m getting:

Failed to load resource: the server responded with a status of 454 (status code 454)
uppy-index.html?user=Administrator:74 Duplicate file detected, marking as complete.

console output:
/files/:1

Failed to load resource: the server responded with a status of 454 (status code 454)
uppy-index.html?user=Administrator:58 Duplicate file detected, not retrying.
onShouldRetry @ uppy-index.html?user=Administrator:58
loggers.js:13 [Uppy] [14:18:40] xxxxxx.pdf tus: unexpected response while creating upload, originated from request (method: POST, url: xxxxxnet/files/, response code: 454, response text: File already exists: xxxxxxx.pdf, request id: n/a)

What I’m Trying to Achieve

  • I want the uppy control to appear as a green success message, complete instead of a red error retry

Hi, Uppy already has build-in protections against duplicate file uploads during the same session. Is that not enough? If you want to prevent it across sessions, maybe you can write a pre-processor?

Some context for this question might help: Pre-create hook - filename needed

Hi Marius,

i’ve implemented this now.

many thanks

Chris