{"record":{"id":"c9e9e57ce818a17c","repo":"thanos-io/thanos","slug":"frontend-cache-queryable-samples-stats-may-only-be","errorCode":null,"errorMessage":"frontend.cache-queryable-samples-stats may only be enabled in conjunction with querier.per-step-stats-enabled. Please set the latter","messagePattern":"frontend\\.cache-queryable-samples-stats may only be enabled in conjunction with querier\\.per-step-stats-enabled\\. Please set the latter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cortex/querier/queryrange/results_cache.go","lineNumber":75,"sourceCode":"\n// RegisterFlags registers flags.\nfunc (cfg *ResultsCacheConfig) RegisterFlags(f *flag.FlagSet) {\n\tcfg.CacheConfig.RegisterFlagsWithPrefix(\"frontend.\", \"\", f)\n\n\tf.StringVar(&cfg.Compression, \"frontend.compression\", \"\", \"Use compression in results cache. Supported values are: 'snappy' and '' (disable compression).\")\n\tf.BoolVar(&cfg.CacheQueryableSamplesStats, \"frontend.cache-queryable-samples-stats\", false, \"Cache Statistics queryable samples on results cache.\")\n}\n\nfunc (cfg *ResultsCacheConfig) Validate(qCfg querier.Config) error {\n\tswitch cfg.Compression {\n\tcase \"snappy\", \"\":\n\t\t// valid\n\tdefault:\n\t\treturn errors.Errorf(\"unsupported compression type: %s\", cfg.Compression)\n\t}\n\n\tif cfg.CacheQueryableSamplesStats && !qCfg.EnablePerStepStats {\n\t\treturn errors.New(\"frontend.cache-queryable-samples-stats may only be enabled in conjunction with querier.per-step-stats-enabled. Please set the latter\")\n\t}\n\n\treturn cfg.CacheConfig.Validate()\n}\n\n// Extractor is used by the cache to extract a subset of a response from a cache entry.\ntype Extractor interface {\n\t// Extract extracts a subset of a response from the `start` and `end` timestamps in milliseconds in the `from` response.\n\tExtract(start, end int64, from Response) Response\n\tExtractForStep(start, end, step int64, from Response) Response\n\tResponseWithoutHeaders(resp Response) Response\n\tResponseWithoutStats(resp Response) Response\n}\n\n// PrometheusResponseExtractor helps extracting specific info from Query Response.\ntype PrometheusResponseExtractor struct{}\n\n// Extract extracts response for specific a range from a response.","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/internal/cortex/querier/queryrange/results_cache.go#L57-L93","documentation":"ResultsCacheConfig.Validate refuses the combination of cache-queryable-samples-stats enabled while querier.per-step-stats-enabled is off. Per-step stats must be computed by the querier for them to be cacheable, so the frontend feature depends on the querier flag.","triggerScenarios":"Starting Cortex with `-querier.cache-queryable-samples-stats=true` (or yaml `cache_queryable_samples_stats`) while `-querier.per-step-stats-enabled` is false.","commonSituations":"Operators enabling per-query stats caching for Grafana without also enabling per-step stats on queriers; split querier/frontend deployments where the two flags are configured on different components.","solutions":["Also set -querier.per-step-stats-enabled=true on all queriers","Or disable -querier.cache-queryable-samples-stats","Ensure both flags are set consistently across frontend and querier configs"],"exampleFix":"# before\nquerier:\n  cache-queryable-samples-stats: true\n# after\nquerier:\n  cache-queryable-samples-stats: true\n  per-step-stats-enabled: true","handlingStrategy":"validation","validationCode":"if cacheQueryableSamplesStats && !perStepStatsEnabled {\n\treturn errors.New(\"enable querier.per-step-stats-enabled first\")\n}","typeGuard":null,"tryCatchPattern":"if err := cfg.Validate(qCfg); err != nil {\n\tif strings.Contains(err.Error(), \"per-step-stats-enabled\") {\n\t\tlog.Warn(\"falling back: cache-queryable-samples-stats disabled\")\n\t\tcfg.CacheQueryableSamplesStats = false\n\t}\n}","preventionTips":["Keep dependent flags in the same config template/bundle","Document flag dependencies in your deployment repo","Validate config at CI time, not just at startup"],"tags":["config","validation","dependency-flag","cortex"],"backgroundTag":"conflicting-config-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"}