{"record":{"id":"45652769515c7c0c","repo":"kopia/kopia","slug":"error-deleting-v-456527","errorCode":null,"errorMessage":"error deleting %v","messagePattern":"error deleting (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command_repository_sync.go","lineNumber":274,"sourceCode":"\t\t\t\tprogressMutex.Lock()\n\n\t\t\t\tif est, ok := tt.Estimate(float64(bytesCopied), float64(totalBytes)); ok {\n\t\t\t\t\teta = fmt.Sprintf(\"%v (%v)\", est.Remaining, formatTimestamp(est.EstimatedEndTime))\n\t\t\t\t\tspeed = units.BytesPerSecondsString(est.SpeedPerSecond)\n\t\t\t\t}\n\n\t\t\t\tc.outputSyncProgress(\n\t\t\t\t\tfmt.Sprintf(\"  Copied %v blobs (%v), Speed: %v, ETA: %v\",\n\t\t\t\t\t\tnumBlobs, units.BytesString(bytesCopied), speed, eta))\n\n\t\t\t\tprogressMutex.Unlock()\n\t\t\t}\n\n\t\t\tfor m := range deleteCh {\n\t\t\t\tlog(ctx).Debugf(\"[%v] Deleting %v (%v bytes)...\\n\", workerID, m.BlobID, m.Length)\n\n\t\t\t\tif err := syncDeleteBlob(ctx, m, dst); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, \"error deleting %v\", m.BlobID)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\t}\n\n\tif err := eg.Wait(); err != nil {\n\t\treturn errors.Wrap(err, \"error copying blobs\")\n\t}\n\n\treturn nil\n}\n\nfunc sliceToChannel(ctx context.Context, md []blob.Metadata) chan blob.Metadata {\n\tch := make(chan blob.Metadata)\n\n\tgo func() {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/cli/command_repository_sync.go#L256-L292","documentation":"Wraps a failure from syncDeleteBlob for a specific BLOB during the delete phase of 'repository sync to --delete', annotating it with the BLOB ID. It means the destination storage refused/failure on DeleteBlob for a reason other than the BLOB already being gone (ErrBlobNotFound is tolerated and returns nil).","triggerScenarios":"Running 'kopia repository sync to ... --delete' where dst.DeleteBlob(ctx, m.BlobID) returns a non-ErrBlobNotFound error: permissions lacking delete rights, storage returning access-denied, network failure, or object-lock/retention policies blocking deletion.","commonSituations":"S3 bucket with Object Lock or versioning-based retention preventing deletes; IAM policy with Put but not DeleteObject; read-only credentials on destination; transient cloud errors.","solutions":["Inspect the wrapped inner error in debug logs to identify the exact storage failure","Grant delete permissions on the destination (e.g. s3:DeleteObject) or use credentials that have them","Check for object-lock/retention/WORM policies on the destination bucket and remove/relax them if sync --delete is intended","Re-run the sync once the storage issue is resolved"],"exampleFix":"// before: IAM policy without delete\n{\"Effect\":\"Allow\",\"Action\":[\"s3:ListBucket\",\"s3:GetObject\",\"s3:PutObject\"],...}\n// after\n{\"Effect\":\"Allow\",\"Action\":[\"s3:ListBucket\",\"s3:GetObject\",\"s3:PutObject\",\"s3:DeleteObject\"],...}","handlingStrategy":"validation","validationCode":"// ensure delete permission exists before running sync --delete\nout, err := testDeleteAccess(dstStorage, probeBlobID)\nif err != nil || !out { return errors.New(\"destination lacks delete permission; --delete will fail\") }","typeGuard":null,"tryCatchPattern":"if err := runSyncDelete(ctx); err != nil {\n    if strings.Contains(err.Error(), \"error deleting \") {\n        log.Printf(\"delete failed: %v — check delete permissions and retention policies\", err)\n    }\n    return err\n}","preventionTips":["Verify destination credentials include delete permissions before using --delete","Check for S3 Object Lock/versioning retention that blocks deletions","Avoid --delete against WORM/read-only destinations","Test the sync with --dry-run first to preview deletions"],"tags":["storage","blob-delete","permissions","s3"],"backgroundTag":"permission-denied","analyzedSha":"82495e54b584c1ef6073c9e1be048f57f8aef078","analyzedAt":"2026-09-07T20:35:21.689Z","contentChangedAt":"2026-09-07T20:35:21.689Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}