{"record":{"id":"2554894b0ec1aae5","repo":"thanos-io/thanos","slug":"delete-file-s-from-bucket","errorCode":null,"errorMessage":"delete file %s from bucket","messagePattern":"delete file (.+?) from bucket","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/block.go","lineNumber":456,"sourceCode":"\t}\n\tmarkedForNoDownsample.Inc()\n\tlevel.Info(logger).Log(\"msg\", \"block has been marked for no downsample\", \"block\", id)\n\treturn nil\n}\n\n// RemoveMark removes the file which marked the block for deletion, no-downsample or no-compact.\nfunc RemoveMark(ctx context.Context, logger log.Logger, bkt objstore.Bucket, id ulid.ULID, removeMark prometheus.Counter, markedFilename string) error {\n\tmarkedFile := path.Join(id.String(), markedFilename)\n\tmarkedFileExists, err := bkt.Exists(ctx, markedFile)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"check if %s file exists in bucket\", markedFile)\n\t}\n\tif !markedFileExists {\n\t\tlevel.Warn(logger).Log(\"msg\", \"requested to remove the mark, but file does not exist\", \"err\", errors.Errorf(\"file %s does not exist in bucket\", markedFile))\n\t\treturn nil\n\t}\n\tif err := bkt.Delete(ctx, markedFile); err != nil {\n\t\treturn errors.Wrapf(err, \"delete file %s from bucket\", markedFile)\n\t}\n\tremoveMark.Inc()\n\tlevel.Info(logger).Log(\"msg\", \"mark has been removed from the block\", \"block\", id)\n\treturn nil\n}\n","sourceCodeStart":438,"sourceCodeEnd":462,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/block.go#L438-L462","documentation":"Wraps bkt.Delete in RemoveMark when deleting the mark file (deletion, no-compact, or no-downsample) that flags the block. It fires on object-storage errors while removing the already-verified mark, leaving the block still marked.","triggerScenarios":"Thrown at pkg/block/block.go:456 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check bucket delete permissions","Retry after transient storage failures","Check for retention/legal-hold policies blocking deletes"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}