Bucket Object Exists

bucket-object-exists · 409

A file meant as new names a key that already holds a file, so the API didn't overwrite it.

These come from the upload routes the console's file browser calls; an app writing with its own S3 keys talks to the store and never meets them. The upload asked for a new file with expectNew, and the key filled after the check before it. sizeBytes and lastModified describe the file there now. An upload in parts stays open, so it can still replace that file or be aborted.

Besides the members every error carries, this type adds code, bucketId, key, sizeBytes and lastModified.

Common causes

  • Another upload, or the app itself, wrote the same key between the conflict check and this upload.
  • The same file was uploaded twice at once.

How to fix the call

  • Ask the user whether to replace the file that is there, showing sizeBytes and lastModified.
  • To replace it, sign the upload again, or complete the upload in parts, with expectNew set to false.
  • To keep it, skip the file, and abort an upload in parts with .../uploads/abort.

Example response

json
{
  "type": "bucket-object-exists",
  "title": "Bucket Object Exists",
  "detail": "Bucket '0199e0a3-6f21-7c4a-9d18-2b7c5f3ad401' already holds 'uploads/report.pdf'",
  "code": "BUCKET_OBJECT_EXISTS",
  "bucketId": "0199e0a3-6f21-7c4a-9d18-2b7c5f3ad401",
  "key": "uploads/report.pdf",
  "sizeBytes": 482113,
  "lastModified": "2026-07-28T09:12:44.000Z",
  "requestId": "req-1785231000000-4f7b2c9ae",
  "timestamp": "2026-07-28T09:30:00.000Z",
  "path": "/v1/buckets/0199e0a3-6f21-7c4a-9d18-2b7c5f3ad401/upload-batches/0199e0a3-6f21-7c4a-9d18-2b7c5f3ad402/uploads",
  "method": "POST",
  "instance": "POST /v1/buckets/0199e0a3-6f21-7c4a-9d18-2b7c5f3ad401/upload-batches/0199e0a3-6f21-7c4a-9d18-2b7c5f3ad402/uploads",
  "status": 409,
  "docs": "https://ghaym.me/docs/errors/bucket-object-exists"
}