{"record":{"id":"bd4c96724979f18e","repo":"thanos-io/thanos","slug":"no-storeapis-matched-for-this-query","errorCode":null,"errorMessage":"No StoreAPIs matched for this query","messagePattern":"No StoreAPIs matched for this query","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/store/proxy.go","lineNumber":48,"sourceCode":"\t\"github.com/thanos-io/thanos/pkg/query/fanout\"\n\tstorecache \"github.com/thanos-io/thanos/pkg/store/cache\"\n\t\"github.com/thanos-io/thanos/pkg/store/labelpb\"\n\t\"github.com/thanos-io/thanos/pkg/store/storepb\"\n\t\"github.com/thanos-io/thanos/pkg/strutil\"\n\t\"github.com/thanos-io/thanos/pkg/tenancy\"\n)\n\ntype ctxKey int\n\n// UninitializedTSDBTime is the TSDB start time of an uninitialized TSDB instance.\nconst UninitializedTSDBTime = math.MaxInt64\n\n// StoreMatcherKey is the context key for the store's allow list.\nconst StoreMatcherKey = ctxKey(0)\n\n// ErrorNoStoresMatched is returned if the query does not match any data.\n// This can happen with Query servers trees and external labels.\nvar ErrorNoStoresMatched = errors.New(\"No StoreAPIs matched for this query\")\n\n// ErrorNoStoresAvailable is returned if we have an empty list of stores.\n// This happens either when we didn't yet complete any discovery\n// or when all stores disappear suddenly.\nvar ErrorNoStoresAvailable = errors.New(\"No StoreAPIs available\")\n\n// Client holds meta information about a store.\ntype Client interface {\n\t// StoreClient to access the store.\n\tstorepb.StoreClient\n\n\t// LabelSets that each apply to some data exposed by the backing store.\n\tLabelSets() []labels.Labels\n\n\t// TimeRange returns minimum and maximum time range of data in the store.\n\tTimeRange() (mint int64, maxt int64)\n\n\t// TSDBInfos returns metadata about each TSDB backed by the client.","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/proxy.go#L30-L66","documentation":"ErrorNoStoresMatched is a sentinel error returned by the proxy Store when, after filtering all discovered stores by external labels, time range, and matchers, no StoreAPI matches the query. Unlike the \"no stores available\" case, stores exist but none is eligible for this request. In ABORT mode it surfaces as an error; in partial-response mode it may just log and return empty.","triggerScenarios":"Query matchers or time range exclude every store's external labels/min-time/max-time — e.g. querying a time window before any store's data, or matchers referencing labels/stores not part of the query tree (common in Thanos Query layering with replicated stores).","commonSituations":"Querying for a time range outside all data retention; wrong external-label values in the query (cluster/replica labels); ruler/receiver stores excluded via store matchers (--store-.* regex flags); dedup/replica label mismatch.","solutions":["Broaden the query time range to overlap the stores' minTime/maxTime","Check matchers against the stores' external labels (Thanos Store flags --store-.* or query's --query.replica-label configuration)","Log/store debug messages (already emitted at debug level) to see why each store was filtered out","If the empty result is acceptable, ensure PartialResponseStrategy is ALLOW and handle the empty stream gracefully"],"exampleFix":"// before: filter excludes everything\nstoreMatchers := []string{\"{cluster=\"wrong\"}\"}\n// after: match the actual external labels\nstoreMatchers := []string{\"{cluster=\"prod\"}\"}","handlingStrategy":"validation","validationCode":"// before querying, ensure the time range overlaps store data and matchers target existing external labels\nif queryEnd < storeMinTime || queryStart > storeMaxTime {\n    return fmt.Errorf(\"time range %d-%d matches no store data\", queryStart, queryEnd)\n}","typeGuard":null,"tryCatchPattern":"resp, err := queryClient.Series(ctx, req)\nif status.Code(err) == codes.Unknown && strings.Contains(err.Error(), ErrorNoStoresMatched.Error()) {\n    // widen time range or fix external-label matchers; or accept empty result\n}","preventionTips":["Enable debug logging (stores debug msgs) to see why stores are filtered","Verify external labels (cluster/replica) used in store matchers match actual data","Sanity-check query time ranges against data retention"],"tags":["thanos","store-gateway","query","no-results"],"backgroundTag":"empty-result-set","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"}