{"record":{"id":"b0972823d98e8efc","repo":"thanos-io/thanos","slug":"split-queries-interval-and-dynamic-query-split-int","errorCode":null,"errorMessage":"split queries interval and dynamic query split interval cannot be set at the same time","messagePattern":"split queries interval and dynamic query split interval cannot be set at the same time","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/queryfrontend/config.go","lineNumber":277,"sourceCode":"\n// Validate a fully initialized config.\nfunc (cfg *Config) Validate() error {\n\tif cfg.QueryRangeConfig.ResultsCacheConfig != nil {\n\t\tif cfg.QueryRangeConfig.SplitQueriesByInterval <= 0 && !cfg.isDynamicSplitSet() {\n\t\t\treturn errors.New(\"split queries or split threshold interval should be greater than 0 when caching is enabled\")\n\t\t}\n\t\t// This is instantiated just to make the QFE config comply with validation against the Cortex Querier,\n\t\t// but in Thanos we don't use this configuration at all.\n\t\tignoredQueryConfig := querier.Config{\n\t\t\tEnablePerStepStats: cfg.QueryRangeConfig.ResultsCacheConfig.CacheQueryableSamplesStats,\n\t\t}\n\t\tif err := cfg.QueryRangeConfig.ResultsCacheConfig.Validate(ignoredQueryConfig); err != nil {\n\t\t\treturn errors.Wrap(err, \"invalid ResultsCache config for query_range tripperware\")\n\t\t}\n\t}\n\n\tif cfg.isDynamicSplitSet() && cfg.isStaticSplitSet() {\n\t\treturn errors.New(\"split queries interval and dynamic query split interval cannot be set at the same time\")\n\t}\n\n\tif cfg.isDynamicSplitSet() {\n\n\t\tif err := cfg.validateDynamicSplitParams(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif cfg.LabelsConfig.ResultsCacheConfig != nil {\n\t\tif cfg.LabelsConfig.SplitQueriesByInterval <= 0 {\n\t\t\treturn errors.New(\"split queries interval should be greater than 0  when caching is enabled\")\n\t\t}\n\t\tif err := cfg.LabelsConfig.ResultsCacheConfig.Validate(querier.Config{}); err != nil {\n\t\t\treturn errors.Wrap(err, \"invalid ResultsCache config for labels tripperware\")\n\t\t}\n\t}\n","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/queryfrontend/config.go#L259-L295","documentation":"Validate rejects mutually exclusive split settings: a static --query-range.split-queries-by-interval and the newer dynamic query-split threshold cannot both be set, because the engine cannot decide which split strategy to apply. Returning this error prevents ambiguous caching/splitting behavior.","triggerScenarios":"cfg.isDynamicSplitSet() and cfg.isStaticSplitSet() are both true — both SplitQueriesByInterval (>0) and the dynamic split threshold are configured.","commonSituations":"Upgrading Thanos from static to dynamic splitting but leaving the old static flag in place; merged configs from multiple deployment tools each adding a split flag.","solutions":["Remove either --query-range.split-queries-by-interval (static) or --query-range.dynamic-split-threshold (dynamic).","Prefer dynamic splitting on newer Thanos; drop the static flag from systemd units, manifests, or Helm values.","Audit all flag sources (CLI, env, Helm) so only one split mechanism is set."],"exampleFix":"// before\nflags := []string{\"--query-range.split-queries-by-interval=24h\", \"--query-range.dynamic-split-threshold=10\"}\n// after\nflags := []string{\"--query-range.dynamic-split-threshold=10\"}","handlingStrategy":"validation","validationCode":"staticSet := splitInterval > 0\ndynamicSet := dynamicSplitThreshold > 0\nif staticSet && dynamicSet {\n    return errors.New(\"only one of --query-range.split-queries-by-interval and --query-range.dynamic-split-threshold may be set\")\n}","typeGuard":null,"tryCatchPattern":"if err := cfg.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"cannot be set at the same time\") {\n        return fmt.Errorf(\"drop one split flag: %w\", err)\n    }\n    return err\n}","preventionTips":["Grep deployment manifests for both split flags when upgrading.","Migrate fully to dynamic split and delete the static flag.","Centralize flag definitions to avoid duplicates across tools."],"tags":["config","validation","mutually-exclusive","query-frontend"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}