thanos-io/thanos · error

check if file exists in bucket

Error message

check if %s file exists in bucket

What it means

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.

Solutions

  1. Check bucket read/exists permissions
  2. Retry after transient object store errors
  3. Verify connectivity to the bucket
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/block/block.go:449 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/dc765dbd43a19a45. Report an issue: GitHub.

Appendix: source

Thrown at pkg/block/block.go:449

	})
	if err != nil {
		return errors.Wrap(err, "json encode no downsample mark")
	}

	if err := bkt.Upload(ctx, m, bytes.NewBuffer(noDownsampleMark)); err != nil {
		return errors.Wrapf(err, "upload file %s to bucket", m)
	}
	markedForNoDownsample.Inc()
	level.Info(logger).Log("msg", "block has been marked for no downsample", "block", id)
	return nil
}

// RemoveMark removes the file which marked the block for deletion, no-downsample or no-compact.
func RemoveMark(ctx context.Context, logger log.Logger, bkt objstore.Bucket, id ulid.ULID, removeMark prometheus.Counter, markedFilename string) error {
	markedFile := path.Join(id.String(), markedFilename)
	markedFileExists, err := bkt.Exists(ctx, markedFile)
	if err != nil {
		return errors.Wrapf(err, "check if %s file exists in bucket", markedFile)
	}
	if !markedFileExists {
		level.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))
		return nil
	}
	if err := bkt.Delete(ctx, markedFile); err != nil {
		return errors.Wrapf(err, "delete file %s from bucket", markedFile)
	}
	removeMark.Inc()
	level.Info(logger).Log("msg", "mark has been removed from the block", "block", id)
	return nil
}

View on GitHub (pinned to 35b8b99117)