VictoriaMetrics/VictoriaMetrics · error
cannot unmarshal point: %w
Error message
cannot unmarshal point: %w
What it means
This error is returned by Series.unmarshalProtobuf (lib/protoparser/datadogv2/parser.go:189) while decoding a DataDog /api/v2/series protobuf request. A `points` submessage (field 4, MetricSeries.points) was present, its length-delimited payload was extracted, but Point.unmarshalProtobuf failed to decode it; the underlying error is wrapped with %w. It means the bytes of that point do not form a valid Point message (double value = 1, int64 timestamp = 2).
Source
Thrown at lib/protoparser/datadogv2/parser.go:189
case 2:
metric, ok := fc.String()
if !ok {
return fmt.Errorf("cannot unmarshal metric")
}
s.Metric = metric
case 4:
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot read point data")
}
if len(points) < cap(points) {
points = points[:len(points)+1]
} else {
points = append(points, Point{})
}
pt := &points[len(points)-1]
if err := pt.unmarshalProtobuf(data); err != nil {
return fmt.Errorf("cannot unmarshal point: %w", err)
}
case 1:
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot read resource data")
}
if len(resources) < cap(resources) {
resources = resources[:len(resources)+1]
} else {
resources = append(resources, Resource{})
}
r := &resources[len(resources)-1]
if err := r.unmarshalProtobuf(data); err != nil {
return fmt.Errorf("cannot unmarshal resource: %w", err)
}
case 7:
sourceTypeName, ok := fc.String()
if !ok {View on GitHub (pinned to 5079fb58f1)
Solutions
- Dump and validate the offending request body against the DataDog agent_payload.proto schema to confirm the Point submessage is well-formed.
- Verify the sender posts the body as application/x-protobuf to /api/v2/series (not JSON) so the bytes match the expected schema.
- Update the sending agent/SDK and VictoriaMetrics to versions built from compatible DataDog agent-payload protos.
- If you own the client, regenerate/re-encode the payload with a real protobuf library and retry; discard the malformed record and let the agent re-send.
Example fix
// before: posting JSON bytes to the protobuf endpoint
http.Post(url+"/api/v2/series", "application/json", body)
// after: serialize the v2 series payload with the DataDog proto and the right content type
data, _ := proto.Marshal(&pb.MetricPayload{Series: series})
http.Post(url+"/api/v2/series", "application/x-protobuf", bytes.NewReader(data)) Defensive patterns
Strategy: validation
Validate before calling
// Validate the payload before calling UnmarshalProtobuf
func looksLikeProtobuf(b []byte) bool {
if len(b) == 0 || b[0]>>3 != 1 { // first field tag should be field 1 (series)
return false
}
return b[0]&0x7 == 2 // wire type 2 (length-delimited)
} Try / catch
if err := datadogv2.UnmarshalProtobuf(&req, body); err != nil {
var wrapErr *fmt.wrapError
errors.As(err, &wrapErr)
log.Printf("bad dd-series protobuf payload (%d bytes): %v", len(body), err)
http.Error(w, "bad request", http.StatusBadRequest)
return
} Prevention
- Always serialize v2 series payloads with generated protobuf code from the official agent-payload schema.
- Post with Content-Type application/x-protobuf to /api/v2/series; never mix JSON and protobuf paths.
- Validate payloads with protoc --decode in CI for any custom sender.
- Monitor 400 responses from VictoriaMetrics to catch sender regressions early.
When it happens
Trigger: Calling UnmarshalProtobuf on a request body whose series field 4 payload is truncated, corrupt, or uses wire types incompatible with easyproto's decoding of a double/int64 Point message (e.g. a varint length that exceeds the remaining bytes, or a nested field with an invalid tag).
Common situations: A DataDog agent or SDK sending a malformed or truncated v2 payload; an HTTP client sending the wrong Content-Type so a protobuf body is delivered as garbage bytes; payload corruption in transit; sender built against an incompatible version of the agent-payload metrics proto.
Understand the failure class
Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.
Related errors
- cannot unmarshal DataDog Sketches request with size %d bytes
- cannot read resource data
- cannot unmarshal resource: %w
- cannot read sum
- cannot read schema
AI-assisted analysis of VictoriaMetrics/VictoriaMetrics@5079fb58f1 (2026-09-03).
Data as JSON: /api/errors/a5e1511b5472dc15.
Report an issue: GitHub.