thanos-io/thanos · error

found that TSDB Max time is

Error message

found that TSDB Max time is %s and Min time is %s. Compaction needs to be disabled (storage.tsdb.min-block-duration = storage.tsdb.max-block-duration)

What it means

validatePrometheus enforces that Prometheus compaction is disabled when shipping blocks: if TSDBMinTime != TSDBMaxTime (variable block durations mean compaction is on) and --storage.tsdb.delay-compact-file is not used, the sidecar refuses to start unless --shipper.ignore-block-size is set. Shipping blocks while Prometheus compacts them can lose data from the bucket.

Solutions

  1. Set --storage.tsdb.min-block-duration=2h --storage.tsdb.max-block-duration=2h on Prometheus to disable compaction.
  2. Or use --storage.tsdb.delay-compact-file pointing at the shipper meta.json path (see error 166).
  3. Or pass --shipper.ignore-block-size to the sidecar if you accept the risk of missing blocks after failed uploads + compaction.
  4. Let Thanos Compactor handle all downsampling/compaction on the bucket.

Example fix

# before
prometheus --config.file=prometheus.yml
# after
prometheus --config.file=prometheus.yml \
  --storage.tsdb.min-block-duration=2h \
  --storage.tsdb.max-block-duration=2h
Defensive patterns

Strategy: validation

Validate before calling

if promMinBlock != promMaxBlock && !delayCompactSet && !ignoreBlockSize {
    return errors.New("disable Prometheus compaction before enabling sidecar upload")
}

Prevention

When it happens

Trigger: flags.TSDBMinTime != flags.TSDBMaxTime && flags.TSDBDelayCompact == "" && !conf.shipper.ignoreBlockSize — i.e. Prometheus's min/max block duration flags differ (default 2h/10d) with no delay-compact-file workaround.

Common situations: Default Prometheus deployment with compaction enabled and Thanos sidecar in upload mode; operator unaware compaction must be off or routed through Thanos Compactor; ignoring the warning via ignore-block-size and later finding gaps after a failed 2h block upload.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at cmd/thanos/sidecar.go:531

		level.Warn(logger).Log("msg", "failed to check Prometheus flags, due to potentially older Prometheus. No extra validation is done.", "err", flagErr)
		return nil
	}

	if flags.TSDBDelayCompact != "" {
		thanosMetaPath := filepath.Join(conf.tsdb.path, conf.shipper.metaFileName)
		if filepath.Clean(flags.TSDBDelayCompact) != filepath.Clean(thanosMetaPath) {
			return errors.Errorf(
				"found that Prometheus and Thanos use different paths for tracking block uploads. "+
					"Prometheus uses --storage.tsdb.delay-compact-file.path=%s while Thanos will write to %s, they must both use the same path.",
				flags.TSDBDelayCompact, thanosMetaPath,
			)
		}
	}

	// Check if compaction is disabled.
	if flags.TSDBMinTime != flags.TSDBMaxTime && flags.TSDBDelayCompact == "" {
		if !conf.shipper.ignoreBlockSize {
			return errors.Errorf("found that TSDB Max time is %s and Min time is %s. "+
				"Compaction needs to be disabled (storage.tsdb.min-block-duration = storage.tsdb.max-block-duration)", flags.TSDBMaxTime, flags.TSDBMinTime)
		}
		level.Warn(logger).Log("msg", "flag to ignore Prometheus min/max block duration flags differing is being used. If the upload of a 2h block fails and a Prometheus compaction happens that block may be missing from your Thanos bucket storage.")
	}
	// Check if block time is 2h.
	if flags.TSDBMinTime != model.Duration(2*time.Hour) {
		level.Warn(logger).Log("msg", "found that TSDB block time is not 2h. Only 2h block time is recommended.", "block-time", flags.TSDBMinTime)
	}

	return nil
}

type promMetadata struct {
	promURL *url.URL

	mtx          sync.Mutex
	mint         int64
	maxt         int64

View on GitHub (pinned to 35b8b99117)