thanos-io/thanos · error

invalid argument: --min-time

Error message

invalid argument: --min-time '%s' can't be greater than --max-time '%s'

What it means

The store command rejects its configuration at Setup time when the --min-time flag value is greater than the --max-time value (both are Prometheus timestamps). The time-range filter would be an empty/contradictory interval, so the process fails fast instead of starting.

Solutions

  1. Swap or correct the flag values so --min-time < --max-time.
  2. Use epoch milliseconds consistently (e.g. --min-time=-9223372036854775808 --max-time=9223372036854775807 for unbounded).
  3. Add a pre-launch check in deployment tooling comparing the two parsed timestamps.

Example fix

# before
thanos store --min-time=2023-01-01T00:00:00Z --max-time=2022-06-01T00:00:00Z
# after
thanos store --min-time=2022-06-01T00:00:00Z --max-time=2023-01-01T00:00:00Z
Defensive patterns

Strategy: validation

Validate before calling

if minTime >= maxTime {
    return errors.Errorf("--min-time %d must be < --max-time %d", minTime, maxTime)
}

Prevention

When it happens

Trigger: Starting `thanos store` with --min-time set to a later timestamp than --max-time, e.g. --min-time=2023-01-01T00:00:00Z with --max-time=2022-12-01T00:00:00Z, or swapped epoch-millisecond values.

Common situations: Copy-pasted flag values in the wrong order; scripts computing min/max timestamps with a bug; templating that swaps the values; time-zone mistakes when using absolute date strings.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at cmd/thanos/store.go:245

	cmd.Flag("bucket-web-label", "External block label to use as group title in the bucket web UI").StringVar(&sc.label)

	cmd.Flag("matcher-cache-size", "Max number of cached matchers items. Using 0 disables caching.").Default("0").IntVar(&sc.matcherCacheSize)

	cmd.Flag("disable-admin-operations", "Disable UI/API admin operations like marking blocks for deletion and no compaction.").Default("false").BoolVar(&sc.disableAdminOperations)

	sc.reqLogConfig = extkingpin.RegisterRequestLoggingFlags(cmd)
}

// registerStore registers a store command.
func registerStore(app *extkingpin.App) {
	cmd := app.Command(component.Store.String(), "Store node giving access to blocks in a bucket provider. Now supported GCS, S3, Azure, Swift, Tencent COS and Aliyun OSS.")

	conf := &storeConfig{}
	conf.registerFlag(cmd)

	cmd.Setup(func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ <-chan struct{}, debugLogging bool) error {
		if conf.filterConf.MinTime.PrometheusTimestamp() > conf.filterConf.MaxTime.PrometheusTimestamp() {
			return errors.Errorf("invalid argument: --min-time '%s' can't be greater than --max-time '%s'",
				conf.filterConf.MinTime, conf.filterConf.MaxTime)
		}

		httpLogOpts, err := logging.ParseHTTPOptions(conf.reqLogConfig)
		if err != nil {
			return errors.Wrap(err, "error while parsing config for request logging")
		}

		grpcLogOpts, logFilterMethods, err := logging.ParsegRPCOptions(conf.reqLogConfig)

		if err != nil {
			return errors.Wrap(err, "error while parsing config for request logging")
		}

		conf.debugLogging = debugLogging

		return runStore(g,
			logger,

View on GitHub (pinned to 35b8b99117)