{"record":{"id":"999944fcb0f90e1a","repo":"transloadit/uppy","slug":"c-error-prefix-failed-to-delete-object-http-sta","errorCode":null,"errorMessage":"${C.ERROR_PREFIX}Failed to delete object. HTTP status: ${xhr.status}","messagePattern":"(.+?)Failed to delete object\\. HTTP status: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@uppy/aws-s3/src/s3-client/S3mini.ts","lineNumber":526,"sourceCode":"    parts: Array<IT.UploadPart>,\n  ): string {\n    let xml = '<CompleteMultipartUpload>'\n    for (const part of parts) {\n      xml += `<Part><PartNumber>${part.partNumber}</PartNumber><ETag>${part.etag}</ETag></Part>`\n    }\n    xml += '</CompleteMultipartUpload>'\n    return xml\n  }\n\n  /** Deletes an object from the bucket. Returns true on success. */\n  public override async deleteObject({ key, signal }: IT.DeleteObjectParams) {\n    const { xhr } = await this.request({\n      request: { method: 'DELETE', key },\n      signal,\n    })\n\n    if (xhr.status !== 200 && xhr.status !== 204) {\n      throw new Error(\n        `${C.ERROR_PREFIX}Failed to delete object. HTTP status: ${xhr.status}`,\n      )\n    }\n  }\n\n  /**\n   * Clears cached credentials.\n   * Call this method when you need to force a credential refresh on the next request.\n   */\n  public clearCachedCredentials(): void {\n    this.cachedCredentials = undefined\n    this.cachedCredentialsPromise = undefined\n  }\n\n  private _parseErrorXml(\n    getHeader: (name: string) => string | null,\n    body: string,\n  ): { svcCode?: string; errorMessage?: string } {","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/transloadit/uppy/blob/5d4dedd02a1ac0ae022c75c54aca76558f88e256/packages/@uppy/aws-s3/src/s3-client/S3mini.ts#L508-L544","documentation":"deleteObject expects HTTP 200 or 204 from a DELETE object request; any other status throws with the raw status code, indicating S3 rejected the deletion.","triggerScenarios":"Calling s3Mini.deleteObject on a key with invalid credentials (403), a non-existent bucket (404), or a key that fails validation (400).","commonSituations":"Cleanup of aborted uploads, removing partially uploaded objects, bucket policy denying DeleteObject.","solutions":["Check xhr/status embedded in the message to identify 403 (permissions) vs 404 (bucket/endpoint)","Verify the bucket policy grants s3:DeleteObject to the credentials","Confirm the endpoint and key are correct (no leading-slash or encoding issues)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try { await deleteObject({ key }) } catch (e) { const status = Number(/HTTP status: (\\d+)/.exec(String(e?.message))?.[1]); if (status === 404 || status === 204) return; throw e }","preventionTips":["Grant s3:DeleteObject in bucket policy","Use exact keys returned at creation time","Treat already-deleted objects as success"],"tags":["s3","delete","http-status"],"backgroundTag":"s3-delete-object-failed","analyzedSha":"5d4dedd02a1ac0ae022c75c54aca76558f88e256","analyzedAt":"2026-08-28T12:18:41.267Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}