thanos-io/thanos · error
empty data field in TSDB status response
Error message
empty data field in TSDB status response
What it means
Client TSDB status retrieval (TSDBStatus/related /prom_status_tsdb call) performs a 2xx GET and decodes into a wrapper struct with a Data field. If the Prometheus API answered successfully but the JSON `data` field is null/absent, the client returns this sentinel error rather than returning a nil pointer.
Solutions
- Check the Prometheus version supports /api/v1/status/tsdb and upgrade if older.
- Ensure the correct API path/flags (e.g. admin APIs enabled) on the target Prometheus.
- Inspect the raw response body with curl to see whether data is null and why.
- Handle the error in callers (e.g. skip TSDB stats collection for that endpoint) instead of crashing.
Example fix
// before
if v.Data == nil {
return nil, errors.New("empty data field in TSDB status response")
}
// after (caller-side tolerant handling)
data, err := client.TSDBStatus(ctx)
if err != nil {
if strings.Contains(err.Error(), "empty data field") {
level.Warn(logger).Log("msg", "TSDB status unavailable for endpoint; skipping")
return nil, nil
}
return nil, err
} Defensive patterns
Strategy: fallback
Type guard
type tsdbStatusWrapper struct { Data json.RawMessage `json:"data"` }
func hasData(w tsdbStatusWrapper) bool { return len(w.Data) > 0 && string(w.Data) != "null" } Try / catch
data, err := client.TSDBStatus(ctx)
if err != nil {
level.Warn(logger).Log("msg", "TSDB status unavailable, continuing without it", "err", err)
data = nil // degrade gracefully
} Prevention
- Confirm target Prometheus supports the TSDB status API for your version
- Enable required admin/API flags on the target
- Treat optional status endpoints as best-effort in callers
When it happens
Trigger: c.get2xxResultWithGRPCErrors succeeds but v.Data == nil — the queried Prometheus version does not populate data for the TSDB status endpoint (older versions, API disabled via --web.enable-admin-api semantics, or an incompatible proxy stripping the payload).
Common situations: Running against an old Prometheus lacking the /api/v1/status/tsdb endpoint shape; admin APIs disabled; intermediary (sidecar/proxy) returning {"status":"success"} with no data.
Understand the failure class
Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.
Related errors
- failed to get prometheus version
- ErrFlagEndpointNotFound
- failed to create matchers cache
- failed to validate prometheus flags
- initial external labels query
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/7f0fd3576d57e1f9.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/promclient/promclient.go:983
q := u.Query()
if len(matchers) > 0 {
q.Add("match[]", storepb.PromMatchersToString(matchers...))
}
if limit > 0 {
q.Add("limit", strconv.Itoa(limit))
}
u.RawQuery = q.Encode()
var v struct {
Data *statuspb.TSDBStatisticsEntry `json:"data"`
}
if err := c.get2xxResultWithGRPCErrors(ctx, "/prom_status_tsdb HTTP[client]", &u, &v); err != nil {
return nil, err
}
if v.Data == nil {
return nil, errors.New("empty data field in TSDB status response")
}
return v.Data, nil
}
View on GitHub (pinned to 35b8b99117)