thanos-io/thanos · warning
res.GetWarning()
Error message
res.GetWarning()
What it means
tsdbStatisticsServer.Send processes responses coming back from the proxy. A response carrying a non-empty warning is appended to srv.warnings and handled gracefully, so the message 'res.GetWarning()' flags the branch where a warning was received (and, if stats are nil and no warning present, 'no tsdb statistics' is returned). It signals an upstream store reported a problem for its statistics.
Solutions
- Read the recorded warning text to identify which store failed and why.
- Fix or restart the offending store node.
- If strictness is required, use ABORT strategy to fail instead of accumulating warnings.
- Check store logs around the same timestamp for the underlying TSDB error.
Example fix
// before
// warnings silently accumulate, request 'succeeds' with partial data
for _, w := range srv.warnings { logger.Warn(w) }
// after
if srv.warnings.Len() > 0 {
return nil, nil, fmt.Errorf("tsdb statistics incomplete: %v", srv.warnings)
} Defensive patterns
Strategy: type-guard
Type guard
func isStatsWarning(res *statuspb.TSDBStatisticsResponse) (string, bool) {
if res == nil {
return "", false
}
w := res.GetWarning()
return w, w != ""
} Try / catch
if err := call(ctx); err != nil {
var warnMsg string
if strings.Contains(err.Error(), "res.GetWarning") || strings.Contains(err.Error(), "no tsdb statistics") {
warnMsg = err.Error()
logger.Warn("partial tsdb statistics", "detail", warnMsg)
return nil
}
return err
} Prevention
- Check and display srv.warnings after aggregation.
- Restart stores reporting warnings before relying on stats.
- Choose ABORT vs WARNINGS strategy based on how much you trust partial data.
- Track warning rates per store as a health signal.
When it happens
Trigger: During TSDBStatistics aggregation, a store member returns a WarningTSDBStatisticsResponse (e.g. that store failed to compute stats), so Send() takes the `res.GetWarning() != ""` branch and records the warning.
Common situations: A store node returning errors under WARNINGS strategy (down disk, TSDB not ready, store starting up); partial results surfaced to the Thanos UI as warnings banner.
Related errors
- Aborted
- res.GetWarning() (propagated warning)
- no tsdb statistics
- TSDB statistics not implemented
- Internal
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/432a82e991b310ef.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/status/status.go:82
return tsdbStatistics, srv.warnings, nil
}
type tsdbStatisticsServer struct {
// This field just exist to pseudo-implement the unused methods of the interface.
statuspb.Status_TSDBStatisticsServer
ctx context.Context
mtx sync.Mutex
warnings annotations.Annotations
tsdbStatistics map[string][]*statuspb.TSDBStatisticsEntry
}
func (srv *tsdbStatisticsServer) Send(res *statuspb.TSDBStatisticsResponse) error {
if res.GetWarning() != "" {
srv.mtx.Lock()
defer srv.mtx.Unlock()
srv.warnings.Add(errors.New(res.GetWarning()))
return nil
}
stats := res.GetStatistics()
if stats == nil {
return errors.New("no tsdb statistics")
}
srv.mtx.Lock()
defer srv.mtx.Unlock()
for tenant, tenantStats := range stats.Statistics {
if _, found := srv.tsdbStatistics[tenant]; !found {
srv.tsdbStatistics[tenant] = nil
}
srv.tsdbStatistics[tenant] = append(srv.tsdbStatistics[tenant], tenantStats)
}
return nilView on GitHub (pinned to 35b8b99117)