thanos-io/thanos · error

sync before second pass of downsampling

Error message

sync before second pass of downsampling

What it means

Wrapper error in runCompact's second downsampling pass (cmd/thanos/compact.go:486) around sy.SyncMetas(ctx). The metadata re-sync after the first downsampling pass failed, preventing discovery of blocks created by the first pass.

Solutions

  1. Inspect the wrapped inner error for the root object-store failure
  2. Retry the run; syncs are idempotent
  3. Check for object-store throttling and add client-side retry/backoff
  4. Verify credentials are still valid for the duration of long runs
Defensive patterns

Strategy: retry

Try / catch

if err := sy.SyncMetas(ctx); err != nil {
	if errors.Is(err, context.Canceled) { return err }
	return errors.Wrap(err, "sync before second pass of downsampling")
}

Prevention

When it happens

Trigger: sy.SyncMetas(ctx) error during the second pass: same causes as any meta sync — object store listing/reading failures, throttling, network errors, corrupt metadata objects.

Common situations: Sustained object store outage or rate limits during long compaction runs; credentials rotated mid-run; large bucket listing timeouts.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at cmd/thanos/compact.go:486

			if err := downsampleBucket(
				ctx,
				logger,
				downsampleMetrics,
				insBkt,
				filteredMetas,
				downsamplingDir,
				conf.downsampleConcurrency,
				conf.blockFilesConcurrency,
				metadata.HashFunc(conf.hashFunc),
				conf.acceptMalformedIndex,
			); err != nil {
				return errors.Wrap(err, "first pass of downsampling failed")
			}

			level.Info(logger).Log("msg", "start second pass of downsampling")
			if err := sy.SyncMetas(ctx); err != nil {
				return errors.Wrap(err, "sync before second pass of downsampling")
			}

			// Regenerate the filtered list of blocks after the sync,
			// to include the blocks created by the first pass.
			filteredMetas = sy.Metas()
			noDownsampleBlocks = noDownsampleMarkerFilter.NoDownsampleMarkedBlocks()
			for ul := range noDownsampleBlocks {
				delete(filteredMetas, ul)
			}

			if err := downsampleBucket(
				ctx,
				logger,
				downsampleMetrics,
				insBkt,
				filteredMetas,
				downsamplingDir,
				conf.downsampleConcurrency,

View on GitHub (pinned to 35b8b99117)