{"record":{"id":"e63f2fc66a7a51ef","repo":"juicedata/juicefs","slug":"delete-failed-s","errorCode":null,"errorMessage":"delete failed: %s","messagePattern":"delete failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/objbench.go","lineNumber":864,"sourceCode":"\t\t}\n\t\tdefer blob.Delete(ctx, key) //nolint:errcheck\n\t\tif h, err := blob.Head(ctx, key); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to head object %s\", err)\n\t\t} else {\n\t\t\tif h.Key() != key {\n\t\t\t\treturn fmt.Errorf(\"expected key 'test' but got %s\", h.Key())\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\trunCase(\"delete an object\", func(blob object.ObjectStorage) error {\n\t\tbr := []byte(\"hello\")\n\t\tif err := blob.Put(ctx, key, bytes.NewReader(br)); err != nil {\n\t\t\treturn fmt.Errorf(\"put object failed: %s\", err)\n\t\t}\n\t\tif err := blob.Delete(ctx, key); err != nil {\n\t\t\treturn fmt.Errorf(\"delete failed: %s\", err)\n\t\t}\n\t\tif _, err := blob.Head(ctx, key); err == nil {\n\t\t\treturn fmt.Errorf(\"expect err is not nil\")\n\t\t}\n\n\t\tif err := blob.Delete(ctx, key); err != nil {\n\t\t\treturn fmt.Errorf(\"delete not existed: %v\", err)\n\t\t}\n\t\treturn nil\n\t})\n\n\trunCase(\"delete non-exist\", func(blob object.ObjectStorage) error {\n\t\tif err := blob.Delete(ctx, key); err != nil {\n\t\t\treturn fmt.Errorf(\"deleting a non-existent object returns an error %v\", err)\n\t\t}\n\t\treturn nil\n\t})\n","sourceCodeStart":846,"sourceCodeEnd":882,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/objbench.go#L846-L882","documentation":"This error is produced by the objbench 'delete an object' self-test case in JuiceFS when the ObjectStorage.Delete call fails on an object that was just successfully put. objbench verifies that each object-storage backend honors the basic Put/Delete/Head contract, and this message wraps the underlying backend error. It indicates the backend rejected or failed the DELETE operation rather than a bug in objbench itself.","triggerScenarios":"The test uploads bytes 'hello' under the test key, then calls blob.Delete(ctx, key) and the storage backend returns a non-nil error — e.g. the bucket/container is missing, credentials lack delete permission, the backend is read-only, or a network/API error occurred during the delete request.","commonSituations":"Running `juicefs objbench` against a bucket where the access key has write but not delete rights (e.g. an S3 policy denying s3:DeleteObject); a versioning/retention (object lock, WORM) configuration blocking deletes; a misconfigured endpoint hitting a read-only replica; transient network failures.","solutions":["Check the wrapped backend error message (the %s payload) for the root cause (403, NoSuchBucket, timeout, etc.).","Verify the credentials/policy allow DeleteObject / delete operations on the target bucket.","Ensure the bucket/container exists and the endpoint URL is correct in the storage URL passed to objbench.","If object lock/retention or versioning blocks deletes, adjust the bucket policy or test against a non-locked bucket.","Retry to rule out transient network errors; then rerun objbench."],"exampleFix":"// before (backend rejects delete)\nif err := blob.Delete(ctx, key); err != nil {\n    return fmt.Errorf(\"delete failed: %s\", err)\n}\n// after: grant delete permission, e.g. S3 IAM policy\n// {\"Effect\":\"Allow\",\"Action\":\"s3:DeleteObject\",\"Resource\":\"arn:aws:s3:::mybucket/*\"}","handlingStrategy":"try-catch","validationCode":"// check delete permission before running\n_, err := blob.Head(ctx, key)\n_ = err // backend reachable check\ndeleteAllowed := policyAllowsDelete(storageURL) // verify IAM/policy out-of-band","typeGuard":null,"tryCatchPattern":"err := blob.Delete(ctx, key)\nif err != nil {\n    log.Printf(\"delete failed, check write/delete perms and bucket: %v\", err)\n    return err\n}","preventionTips":["Grant s3:DeleteObject (or equivalent) to test credentials.","Avoid object-lock/retention buckets for benchmarks.","Use a dedicated clean bucket/prefix for objbench.","Check connectivity to the endpoint before running."],"tags":["object-storage","delete","benchmark","s3"],"backgroundTag":"api-error-response","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}