thanos-io/thanos · error
parsing replica header
Error message
parsing replica header: %w
What it means
The wrap text accompanying the replica-header parse failure in handleV1HTTP — the underlying strconv error is wrapped with this message (including %w) so callers see both the raw parse error and that it came from parsing the replica header.
Solutions
- Inspect the wrapped strconv error for the offending value.
- Fix the header to a valid unsigned integer.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/receive/handler.go:698 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/67627b02f9226854.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/receive/handler.go:698
for _, i := range wreq.Timeseries {
hs += len(i.Histograms)
ts += len(i.Samples)
es += len(i.Exemplars)
}
w.Header().Set("X-Prometheus-Remote-Write-Samples-Written", fmt.Sprintf("%d", ts))
w.Header().Set("X-Prometheus-Remote-Write-Histograms-Written", fmt.Sprintf("%d", hs))
w.Header().Set("X-Prometheus-Remote-Write-Exemplars-Written", fmt.Sprintf("%d", es))
}
func (h *Handler) handleV1HTTP(ctx context.Context, w http.ResponseWriter, r *http.Request, wreq *prompb.WriteRequest, tLogger log.Logger, tenantHTTP string, requestLimiter requestLimiter) error {
var err error
rep := uint64(0)
// If the header is empty, we assume the request is not yet replicated.
if replicaRaw := r.Header.Get(h.options.ReplicaHeader); replicaRaw != "" {
if rep, err = strconv.ParseUint(replicaRaw, 10, 64); err != nil {
http.Error(w, "could not parse replica header", http.StatusBadRequest)
return fmt.Errorf("parsing replica header: %w", err)
}
}
// Exit early if the request contained no data. We don't support metadata yet. We also cannot fail here, because
// this would mean lack of forward compatibility for remote write proto.
if len(wreq.Timeseries) == 0 {
// TODO(yeya24): Handle remote write metadata.
if len(wreq.Metadata) > 0 {
// TODO(bwplotka): Do we need this error message?
level.Debug(tLogger).Log("msg", "only metadata from client; metadata ingestion not supported; skipping")
return nil
}
level.Debug(tLogger).Log("msg", "empty remote write request; client bug or newer remote write protocol used?; skipping")
return nil
}
if !requestLimiter.AllowSeries(tenantHTTP, int64(len(wreq.Timeseries))) {
http.Error(w, "too many timeseries", http.StatusRequestEntityTooLarge)View on GitHub (pinned to 35b8b99117)