thanos-io/thanos · error
required headers Content-Type and/or…
Error message
required headers Content-Type and/or X-Prometheus-Remote-Write-Version not found
What it means
The fall-through error of determineRWVersion: the remote-write request declares version 2.0.0 via X-Prometheus-Remote-Write-Version but its Content-Type matches none of the accepted protobuf content types (v2 proto, plain x-protobuf, or v1 proto), or the header/content-type combination is otherwise unrecognized. The handler cannot decide which wire format to decode and rejects the write.
Solutions
- Use a supported Content-Type (application/x-protobuf with a known proto).
- Check the remote-write client version and headers.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/receive/handler.go:564 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/3e88304e42aa797d.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/receive/handler.go:564
func determineRWVersion(r *http.Request) (int, error) {
if r.Header.Get("X-Prometheus-Remote-Write-Version") != "2.0.0" {
return 1, nil
}
ct := r.Header.Get("Content-Type")
if ct == "" {
return 0, fmt.Errorf("missing Content-Type header")
}
if ct == "application/x-protobuf;proto=io.prometheus.write.v2.Request" {
return 2, nil
}
if ct == "application/x-protobuf" {
return 1, nil
}
if ct == "application/x-protobuf;proto=prometheus.WriteRequest" {
return 1, nil
}
return 0, fmt.Errorf("required headers Content-Type and/or X-Prometheus-Remote-Write-Version not found")
}
func translateV2ToV1(w writev2.Request) *prompb.WriteRequest {
// TODO(GiedriusS): somehow ensure programmatically that all fields are set and we don't miss anything.
out := &prompb.WriteRequest{
Timeseries: make([]prompb.TimeSeries, 0, len(w.Timeseries)),
}
for _, t := range w.Timeseries {
v1Ts := prompb.TimeSeries{}
v1Ts.Labels = make([]labelpb.ZLabel, 0, len(t.LabelsRefs)/2)
for i := 0; i+1 < len(t.LabelsRefs); i += 2 {
v1Ts.Labels = append(v1Ts.Labels, labelpb.ZLabel{
Name: w.Symbols[t.LabelsRefs[i]],
Value: w.Symbols[t.LabelsRefs[i+1]],
})
}View on GitHub (pinned to 35b8b99117)