VictoriaMetrics/VictoriaMetrics · error
cannot unmarshal DataDog %s request with size %d bytes: %w
Error message
cannot unmarshal DataDog %s request with size %d bytes: %w
What it means
Returned by the DataDog v2 streamparser's parseData when the request body (identified as contentType, either application/x-protobuf or JSON) cannot be unmarshaled into datadogv2.Request — it wraps the UnmarshalProtobuf/UnmarshalJSON error. %d is the body size in bytes.
Source
Thrown at lib/protoparser/datadogv2/stream/streamparser.go:43
return fmt.Errorf("cannot decode DataDog protocol data: %w", err)
}
return nil
}
func parseData(data []byte, contentType string, callback func(series []datadogv2.Series) error) error {
req := getRequest()
defer putRequest(req)
var err error
switch contentType {
case "application/x-protobuf":
err = datadogv2.UnmarshalProtobuf(req, data)
default:
err = datadogv2.UnmarshalJSON(req, data)
}
if err != nil {
unmarshalErrors.Inc()
return fmt.Errorf("cannot unmarshal DataDog %s request with size %d bytes: %w", contentType, len(data), err)
}
rows := 0
series := req.Series
for i := range series {
rows += len(series[i].Points)
if *datadogutil.SanitizeMetricName {
series[i].Metric = datadogutil.SanitizeName(series[i].Metric)
}
}
rowsRead.Add(rows)
if err := callback(series); err != nil {
return fmt.Errorf("error when processing imported data: %w", err)
}
return nil
}
View on GitHub (pinned to 5079fb58f1)
Solutions
- Match Content-Type to the body: application/json or application/x-protobuf
- Fix the payload per the DataDog v2 series schema
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at lib/protoparser/datadogv2/stream/streamparser.go:43 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of VictoriaMetrics/VictoriaMetrics@5079fb58f1 (2026-09-03).
Data as JSON: /api/errors/e309f8c974a37ea0.
Report an issue: GitHub.