thanos-io/thanos · error
max query split interval should be greater than 0 when…
Error message
max query split interval should be greater than 0 when query split threshold is enabled
What it means
validateDynamicSplitParams requires MaxQuerySplitInterval > 0 when the dynamic query-split threshold feature is enabled. This bounds the maximum width of generated query splits; a zero/negative value makes the interval computation invalid, so Validate fails at startup.
Solutions
- Set query_frontend.max_query_split_interval to a positive duration (e.g. 24h)
- Ensure max > min_query_split_interval for a meaningful range
- Disable query_split_threshold if dynamic splitting is not needed
Example fix
// before query_frontend: query_split_threshold: 100000 min_query_split_interval: 1h // after query_frontend: query_split_threshold: 100000 min_query_split_interval: 1h max_query_split_interval: 24h
Defensive patterns
Strategy: validation
Validate before calling
if cfg.MaxQuerySplitInterval <= 0 {
return errors.New("max_query_split_interval must be > 0 when query_split_threshold is enabled")
} Type guard
func maxSplitIntervalSet(d time.Duration) bool { return d > 0 } Try / catch
if err := cfg.Validate(); err != nil {
if strings.Contains(err.Error(), "max query split interval") {
log.Fatalf("set max_query_split_interval > 0: %v", err)
}
} Prevention
- Set max_query_split_interval and min_query_split_interval as a pair with min <= max
- Keep these fields in the shared config template for all environments
- Verify durations after env expansion render valid values
When it happens
Trigger: Validate -> validateDynamicSplitParams is called with cfg.MaxQuerySplitInterval <= 0 — query_split_threshold is enabled but max_query_split_interval is unset or set to 0/negative.
Common situations: Configs enabling dynamic splitting but only setting min_query_split_interval; zero-valued defaults on new fields after upgrading Cortex; copy-pasted config blocks that dropped the max interval line.
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
- min query split interval should be greater than 0 when…
- split queries or split threshold interval should be greater…
- invalid ResultsCache config for query_range tripperware
- split queries interval and dynamic query split interval…
- split queries interval should be greater than 0 when…
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/976efe60189cfc2d.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/queryfrontend/config.go:313
if cfg.DefaultTimeRange == 0 {
return errors.New("labels.default-time-range cannot be set to 0")
}
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)