thanos-io/thanos · error
split queries interval should be greater than 0 when…
Error message
split queries interval should be greater than 0 when caching is enabled
What it means
Validate checks the labels tripperware configuration: when the labels results cache is enabled (LabelsConfig.ResultsCacheConfig != nil), LabelsConfig.SplitQueriesByInterval must be > 0 so label queries can be split into cacheable chunks. Note the message contains a double space ('> 0 when'), a known typo.
Solutions
- Set --labels.split-queries-by-interval to a positive duration (e.g. 24h).
- Or disable the labels results cache if splitting is not desired.
- Review Thanos release notes for labels caching defaults after upgrades.
Example fix
// before
flags := []string{"--labels.response-cache-config-file=cache.yml"}
// after
flags := []string{"--labels.response-cache-config-file=cache.yml", "--labels.split-queries-by-interval=24h"} Defensive patterns
Strategy: validation
Validate before calling
if labelsCachingEnabled && labelsSplitInterval <= 0 {
return errors.New("--labels.split-queries-by-interval must be > 0 when labels caching is enabled")
} Try / catch
if err := cfg.Validate(); err != nil {
if strings.Contains(err.Error(), "split queries interval should be greater than 0") && labelsCachingEnabled {
return fmt.Errorf("set --labels.split-queries-by-interval: %w", err)
}
return err
} Prevention
- Pair --labels.response-cache-config with --labels.split-queries-by-interval in all deployments.
- Add flag-combination checks to CI pipelines.
- Review labels caching defaults after each Thanos upgrade.
When it happens
Trigger: Labels caching is enabled while cfg.LabelsConfig.SplitQueriesByInterval is 0 or negative.
Common situations: Operator enables --labels.response-cache-config but forgets --labels.split-queries-by-interval; flag defaults changed between Thanos versions leaving it unset.
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
- split queries or split threshold interval should be greater…
- invalid ResultsCache config for query_range tripperware
- labels.default-time-range cannot be set to 0
- unsupported format for label
- split queries interval and dynamic query split interval…
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/e008574b07cf76c5.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/queryfrontend/config.go:289
if err := cfg.QueryRangeConfig.ResultsCacheConfig.Validate(ignoredQueryConfig); err != nil {
return errors.Wrap(err, "invalid ResultsCache config for query_range tripperware")
}
}
if cfg.isDynamicSplitSet() && cfg.isStaticSplitSet() {
return errors.New("split queries interval and dynamic query split interval cannot be set at the same time")
}
if cfg.isDynamicSplitSet() {
if err := cfg.validateDynamicSplitParams(); err != nil {
return err
}
}
if cfg.LabelsConfig.ResultsCacheConfig != nil {
if cfg.LabelsConfig.SplitQueriesByInterval <= 0 {
return errors.New("split queries interval should be greater than 0 when caching is enabled")
}
if err := cfg.LabelsConfig.ResultsCacheConfig.Validate(querier.Config{}); err != nil {
return errors.Wrap(err, "invalid ResultsCache config for labels tripperware")
}
}
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 {View on GitHub (pinned to 35b8b99117)