{"record":{"id":"dc765dbd43a19a45","repo":"thanos-io/thanos","slug":"check-if-s-file-exists-in-bucket","errorCode":null,"errorMessage":"check if %s file exists in bucket","messagePattern":"check if (.+?) file exists in bucket","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/block.go","lineNumber":449,"sourceCode":"\t})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"json encode no downsample mark\")\n\t}\n\n\tif err := bkt.Upload(ctx, m, bytes.NewBuffer(noDownsampleMark)); err != nil {\n\t\treturn errors.Wrapf(err, \"upload file %s to bucket\", m)\n\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":431,"sourceCodeEnd":462,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/block.go#L431-L462","documentation":"RemoveMark's Exists check on the marker file failed with a storage error, so it cannot determine whether the mark is present. This is a guard before delete; the offending input is the object-store operation failing.","triggerScenarios":"Thrown at pkg/block/block.go:449 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check bucket read/exists permissions","Retry after transient object store errors","Verify connectivity to the bucket"],"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"}