{"record":{"id":"edea5c19b9160700","repo":"thanos-io/thanos","slug":"not-ready-edea5c","errorCode":null,"errorMessage":"not ready","messagePattern":"not ready","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/thanos/sidecar.go","lineNumber":361,"sourceCode":"\t\t\t\t\t\tSupportsWithoutReplicaLabels: true,\n\t\t\t\t\t\tTsdbInfos:                    promStore.TSDBInfos(),\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\t\t\t\treturn nil, errors.New(\"Not ready\")\n\t\t\t}),\n\t\t\tinfo.WithExemplarsInfoFunc(),\n\t\t\tinfo.WithRulesInfoFunc(),\n\t\t\tinfo.WithTargetsInfoFunc(),\n\t\t\tinfo.WithMetricMetadataInfoFunc(),\n\t\t\tinfo.WithStatusInfoFunc(),\n\t\t)\n\n\t\tstatusSrv := status.NewServer(\n\t\t\tcomponent.Sidecar.String(),\n\t\t\tstatus.WithTSDBStatisticsGetter(\n\t\t\t\tstatus.TSDBStatisticsGetterFunc(func(limit int, matchers []storepb.LabelMatcher) (map[string]tsdb.Stats, error) {\n\t\t\t\t\tif !httpProbe.IsReady() {\n\t\t\t\t\t\treturn nil, errors.New(\"not ready\")\n\t\t\t\t\t}\n\n\t\t\t\t\tctx, cancel := context.WithTimeout(context.Background(), conf.prometheus.getConfigTimeout)\n\t\t\t\t\tdefer cancel()\n\n\t\t\t\t\t// Check if external labels match the provided matchers.\n\t\t\t\t\textLabels := m.Labels()\n\t\t\t\t\tpromMatchers, err := storepb.MatchersToPromMatchers(matchers...)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, errors.Wrap(err, \"failed to convert matchers\")\n\t\t\t\t\t}\n\t\t\t\t\tfor _, matcher := range promMatchers {\n\t\t\t\t\t\tif !matcher.Matches(extLabels.Get(matcher.Name)) {\n\t\t\t\t\t\t\t// External labels don't match, return empty result.\n\t\t\t\t\t\t\treturn nil, nil\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/sidecar.go#L343-L379","documentation":"The Status gRPC server's TSDB statistics getter returns errors.New(\"not ready\") when the sidecar's HTTP probe indicates it is not ready. Requests for TSDB stats (cardinality, posting) are rejected until the sidecar finished startup validation against Prometheus.","triggerScenarios":"status.NewServer TSDBStatisticsGetterFunc invoked while !httpProbe.IsReady() — sidecar still starting (labels/version not yet loaded) or after readiness was revoked.","commonSituations":"Users hitting the Thanos UI/Status TSDB stats page during a sidecar restart; automated tooling calling status TSDBStatistics RPC at boot; probes racing the startup sequence.","solutions":["Retry the request after the sidecar's /-/ready endpoint returns success","Add readiness gating in clients/UI before issuing TSDB stats queries","Investigate why the sidecar is not ready if the condition persists (check startup logs)","Restart the sidecar once Prometheus is confirmed healthy"],"exampleFix":"// before\nstats, err := statusClient.TSDBStatistics(ctx, req)   // during restart\n// after\nif err := waitForReady(sidecarAddr, 60*time.Second); err != nil {\n    return err\n}\nstats, err := statusClient.TSDBStatistics(ctx, req)","handlingStrategy":"retry","validationCode":"if resp, err := http.Get(sidecarURL + \"/-/ready\"); err != nil || resp.StatusCode != 200 {\n    return errors.New(\"sidecar not ready; defer TSDB statistics request\")\n}","typeGuard":null,"tryCatchPattern":"err := retry.Do(3, func() error {\n    _, err := statusClient.TSDBStatistics(ctx, req)\n    return err\n})","preventionTips":["Only query Status TSDB stats when the sidecar reports /-/ready","Add backoff retries in UIs/tooling calling TSDBStatistics","Check sidecar logs if not-ready persists beyond startup window","Sequence dashboards/automation after deployment readiness gates"],"tags":["grpc","readiness","status-api","thanos"],"backgroundTag":"service-not-ready","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"}