thanos-io/thanos · error

found that Prometheus and Thanos use different paths for…

Error message

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.

What it means

validatePrometheus rejects the configuration when Prometheus's --storage.tsdb.delay-compact-file.path flag points to a different file than the path where the Thanos shipper writes its meta.json. Both processes must track delayed-compaction block uploads at the same path, otherwise upload tracking diverges.

Solutions

  1. Make Prometheus's --storage.tsdb.delay-compact-file.path exactly equal to <thanos --tsdb.path>/<shipper meta file name> (default meta.json in the TSDB dir).
  2. Or remove the delay-compact-file flag from Prometheus if the delayed-compaction feature is not intended.
  3. Verify both resolved paths with realpath and compare.

Example fix

# before
prometheus --storage.tsdb.delay-compact-file.path=/prometheus/upload-tracking.json
thanos sidecar --tsdb.path=/prometheus
# after
prometheus --storage.tsdb.delay-compact-file.path=/prometheus/meta.json
thanos sidecar --tsdb.path=/prometheus
Defensive patterns

Strategy: validation

Validate before calling

if promFlag != filepath.Clean(tsdbPath + "/meta.json") {
    return errors.New("delay-compact-file.path must match thanos shipper meta path")
}

Prevention

When it happens

Trigger: flags.TSDBDelayCompact is non-empty and filepath.Clean(Prometheus flag value) != filepath.Clean(conf.tsdb.path + shipper.metaFileName); i.e. the two configured paths differ after normalization.

Common situations: Operator set --storage.tsdb.delay-compact-file.path in Prometheus but did not align --tsdb.path/--shipper.meta-file-name on the Thanos side; relative vs absolute path confusion (though Clean is applied); copy-pasting the flag from another host.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at cmd/thanos/sidecar.go:520

	if err := runutil.Retry(2*time.Second, ctx.Done(), func() error {
		if flags, flagErr = client.ConfiguredFlags(ctx, m.promURL); flagErr != nil && flagErr != promclient.ErrFlagEndpointNotFound {
			level.Warn(logger).Log("msg", "failed to get Prometheus flags. Is Prometheus running? Retrying", "err", flagErr)
			return errors.Wrapf(flagErr, "fetch Prometheus flags")
		}
		return nil
	}); err != nil {
		return errors.Wrapf(err, "fetch Prometheus flags")
	}

	if flagErr != nil {
		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)

View on GitHub (pinned to 35b8b99117)