thanos-io/thanos · error

min query split interval should be greater than 0 when…

Error message

min query split interval should be greater than 0 when query split threshold is enabled

What it means

validateDynamicSplitParams requires MinQuerySplitInterval > 0 when the dynamic query-split threshold feature is enabled. This is the narrowest split width the frontend may generate; zero or negative makes the splitter produce invalid ranges, so Validate rejects the config.

Solutions

  1. Set query_frontend.min_query_split_interval to a positive duration (e.g. 1h)
  2. Ensure it is smaller than max_query_split_interval
  3. Disable query_split_threshold if dynamic splitting is not desired

Example fix

// before
query_frontend:
  query_split_threshold: 100000
  max_query_split_interval: 24h
// after
query_frontend:
  query_split_threshold: 100000
  max_query_split_interval: 24h
  min_query_split_interval: 1h
Defensive patterns

Strategy: validation

Validate before calling

if cfg.MinQuerySplitInterval <= 0 {
    return errors.New("min_query_split_interval must be > 0 when query_split_threshold is enabled")
}
if cfg.MinQuerySplitInterval > cfg.MaxQuerySplitInterval {
    return errors.New("min_query_split_interval must be <= max_query_split_interval")
}

Type guard

func minSplitIntervalSet(d time.Duration) bool { return d > 0 }

Try / catch

if err := cfg.Validate(); err != nil {
    if strings.Contains(err.Error(), "min query split interval") {
        log.Fatalf("set min_query_split_interval > 0: %v", err)
    }
}

Prevention

When it happens

Trigger: Validate -> validateDynamicSplitParams is called with cfg.MinQuerySplitInterval <= 0 — query_split_threshold enabled but min_query_split_interval unset or set to 0/negative.

Common situations: Operators enabling query_split_threshold and setting only max_query_split_interval; upgrades where the new min interval field defaults to zero; templated configs with a computed value evaluating to 0.

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/32dbe6682033e79a. Report an issue: GitHub.

Appendix: source

Thrown at pkg/queryfrontend/config.go:317

	if cfg.DownstreamURL == "" {
		return errors.New("downstream URL should be configured")
	}

	return nil
}

func (cfg *Config) validateDynamicSplitParams() error {
	if cfg.HorizontalShards <= 0 {
		return errors.New("min horizontal shards should be greater than 0 when query split threshold is enabled")
	}

	if cfg.MaxQuerySplitInterval <= 0 {
		return errors.New("max query split interval should be greater than 0 when query split threshold is enabled")
	}

	if cfg.MinQuerySplitInterval <= 0 {
		return errors.New("min query split interval should be greater than 0 when query split threshold is enabled")
	}
	return nil
}

func (cfg *Config) isStaticSplitSet() bool {
	return cfg.QueryRangeConfig.SplitQueriesByInterval != 0
}

func (cfg *Config) isDynamicSplitSet() bool {
	return cfg.MinQuerySplitInterval > 0 ||
		cfg.HorizontalShards > 0 ||
		cfg.MaxQuerySplitInterval > 0
}

View on GitHub (pinned to 35b8b99117)