thanos-io/thanos · error
snappy decode error
Error message
snappy decode error
What it means
Logged (and returned as HTTP 400) when s2.Decode fails on the request body of a remote-write v1 endpoint: the snappy-compressed payload is corrupt or not actually snappy/s2-encoded. The compressed bytes were read successfully; only decompression failed, so the client is at fault.
Solutions
- Ensure the sender snappy-encodes the body (remote-write v1).
- Check for double compression or corruption in transit.
- 400: do not retry the unchanged payload.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/receive/handler.go:835 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/c69ad2570937bc9f.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/receive/handler.go:835
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)
return
}
switch rwVersion {
case 1:
// NOTE: Due to zero copy ZLabels, Labels used from WriteRequests keeps memory
// from the whole request. Ensure that we always copy those when we want toView on GitHub (pinned to 35b8b99117)