{"record":{"id":"1b62ed9a6eccc8b1","repo":"thanos-io/thanos","slug":"missing-content-type-header","errorCode":null,"errorMessage":"missing Content-Type header","messagePattern":"missing Content-Type header","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/receive/handler.go","lineNumber":553,"sourceCode":"\t}\n}\n\n// retryAfterDuration returns the backoff duration for the Retry-After header,\n// applying jitter when configured. A jitter of 0 returns the plain backoff.\nfunc (h *Handler) retryAfterDuration() time.Duration {\n\tif h.options.RetryAfterJitter <= 0 {\n\t\treturn h.options.RetryAfterBackoff\n\t}\n\treturn util.DurationWithJitter(h.options.RetryAfterBackoff, h.options.RetryAfterJitter)\n}\n\nfunc determineRWVersion(r *http.Request) (int, error) {\n\tif r.Header.Get(\"X-Prometheus-Remote-Write-Version\") != \"2.0.0\" {\n\t\treturn 1, nil\n\t}\n\tct := r.Header.Get(\"Content-Type\")\n\tif ct == \"\" {\n\t\treturn 0, fmt.Errorf(\"missing Content-Type header\")\n\t}\n\tif ct == \"application/x-protobuf;proto=io.prometheus.write.v2.Request\" {\n\t\treturn 2, nil\n\t}\n\tif ct == \"application/x-protobuf\" {\n\t\treturn 1, nil\n\t}\n\tif ct == \"application/x-protobuf;proto=prometheus.WriteRequest\" {\n\t\treturn 1, nil\n\t}\n\treturn 0, fmt.Errorf(\"required headers Content-Type and/or X-Prometheus-Remote-Write-Version not found\")\n}\n\nfunc translateV2ToV1(w writev2.Request) *prompb.WriteRequest {\n\t// TODO(GiedriusS): somehow ensure programmatically that all fields are set and we don't miss anything.\n\tout := &prompb.WriteRequest{\n\t\tTimeseries: make([]prompb.TimeSeries, 0, len(w.Timeseries)),\n\t}","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/receive/handler.go#L535-L571","documentation":"determineRWVersion returns this when the request advertises remote-write version 2.0.0 via X-Prometheus-Remote-Write-Version but carries no Content-Type header, so the protocol version cannot be confirmed.","triggerScenarios":"Thrown at pkg/receive/handler.go:553 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send Content-Type matching the remote-write version (application/x-protobuf;proto=io.prometheus.write.v2.Request for v2).","Check the sender's header construction."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}