thanos-io/thanos · error
read compressed request body
Error message
read compressed request body
What it means
io.Copy from r.Body into the compressed buffer failed while reading the snappy-compressed request body (client disconnect or network error mid-upload), so the handler responds 500 and the request is lost.
Solutions
- Retry the request; the connection broke mid-transfer.
- Check client and network stability.
- Verify no proxy times out long uploads.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at pkg/receive/handler.go:829 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/6cc64973c882d2da.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/receive/handler.go:829
return
}
requestLimiter := h.Limiter.RequestLimiter()
// io.ReadAll dynamically adjust the byte slice for read data, starting from 512B.
// Since this is receive hot path, grow upfront saving allocations and CPU time.
compressed := bytes.Buffer{}
if r.ContentLength >= 0 {
if !requestLimiter.AllowSizeBytes(tenantHTTP, r.ContentLength) {
http.Error(w, "write request too large", http.StatusRequestEntityTooLarge)
return
}
compressed.Grow(int(r.ContentLength))
} else {
compressed.Grow(512)
}
_, err = io.Copy(&compressed, r.Body)
if err != nil {
http.Error(w, errors.Wrap(err, "read compressed request body").Error(), http.StatusInternalServerError)
return
}
reqBuf, err := s2.Decode(nil, compressed.Bytes())
if err != nil {
level.Error(tLogger).Log("msg", "snappy decode error", "err", err)
http.Error(w, errors.Wrap(err, "snappy decode error").Error(), http.StatusBadRequest)
return
}
if !requestLimiter.AllowSizeBytes(tenantHTTP, int64(len(reqBuf))) {
http.Error(w, "write request too large", http.StatusRequestEntityTooLarge)
return
}
rwVersion, err := determineRWVersion(r)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
returnView on GitHub (pinned to 35b8b99117)