{"record":{"id":"63d93935abd41bfa","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-unmarshal-value","errorCode":null,"errorMessage":"cannot unmarshal value","messagePattern":"cannot unmarshal value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/protoparser/datadogv2/parser.go","lineNumber":258,"sourceCode":"\nfunc (pt *Point) unmarshalProtobuf(src []byte) (err error) {\n\t// message Point {\n\t//   double value = 1;\n\t//   int64 timestamp = 2;\n\t// }\n\t//\n\t// See https://github.com/DataDog/agent-payload/blob/d7c5dcc63970d0e19678a342e7718448dd777062/proto/metrics/agent_payload.proto\n\tvar fc easyproto.FieldContext\n\tfor len(src) > 0 {\n\t\tsrc, err = fc.NextField(src)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot unmarshal next field: %w\", err)\n\t\t}\n\t\tswitch fc.FieldNum {\n\t\tcase 1:\n\t\t\tvalue, ok := fc.Double()\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot unmarshal value\")\n\t\t\t}\n\t\t\tpt.Value = value\n\t\tcase 2:\n\t\t\ttimestamp, ok := fc.Int64()\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot unmarshal timestamp\")\n\t\t\t}\n\t\t\tpt.Timestamp = timestamp\n\t\t}\n\t}\n\treturn nil\n}\n\n// Resource is series resource from DataDog POST request to /api/v2/series\n//\n// See https://docs.datadoghq.com/api/latest/metrics/#submit-metrics\ntype Resource struct {\n\tName string `json:\"name\"`","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/protoparser/datadogv2/parser.go#L240-L276","documentation":"Raised at lib/protoparser/datadogv2/parser.go:258 when Point field 1 (double value) in a DataDog v2 series payload cannot be read: FieldContext.Double() returned false because the field's wire type is not fixed64 (the protobuf encoding of double). The point, and thus the request, is rejected.","triggerScenarios":"A Point submessage encodes value (field 1) as varint/fixed32/length-delimited instead of fixed64, or the field data is truncated before 8 bytes.","commonSituations":"Hand-rolled encoders writing float values as varints; clients built against a proto where value was declared as a different type; corrupt payloads after queueing/retry pipelines.","solutions":["Verify field 1 of the Point message is wire type 1 (fixed64) via protoc --decode_raw.","Fix the sender to declare `double value = 1;` in the Point proto and regenerate the encoder.","Update the sending SDK/agent to the official agent-payload version.","Log the wrapped inner error and reject the offending series rather than accepting zero values."],"exampleFix":"// before: value written as varint float bits\nbuf = appendVarint(buf, math.Float64bits(v))\n// after: declare double in proto so it is fixed64-encoded\n// message Point { double value = 1; int64 timestamp = 2; }\nproto.Marshal(&pb.Point{Value: v, Timestamp: ts})","handlingStrategy":"validation","validationCode":"// Point.value must be a double (fixed64, wire type 1):\n// protoc --decode_raw < point.bin  =>  \"1: 0x4059000000000000\"\nif math.IsNaN(value) || math.IsInf(value, 0) {\n\t// still encodable, but ensure it goes through proto.Marshal, not hand-rolled encoding\n\t_ = proto.Marshal(&pb.Point{Value: value, Timestamp: ts})\n}","typeGuard":null,"tryCatchPattern":"if err := datadogv2.UnmarshalProtobuf(&req, body); err != nil {\n\tif strings.Contains(err.Error(), \"cannot unmarshal value\") {\n\t\tlog.Printf(\"point value encoded with wrong wire type: %v\", err)\n\t}\n\thttp.Error(w, \"bad point value\", http.StatusBadRequest)\n\treturn\n}","preventionTips":["Declare point value as `double` in the proto so it is fixed64-encoded; avoid varint float encodings.","Use generated protobuf marshalers exclusively for Point messages.","Round-trip test every Point encoding change in CI.","Keep agent-payload proto revisions in sync between sender and VictoriaMetrics."],"tags":["protobuf","datadog","wire-format","points"],"backgroundTag":"protobuf-schema-mismatch","analyzedSha":"5079fb58f1e8e62113f90c945ad71586c797d770","analyzedAt":"2026-09-03T18:10:26.153Z","contentChangedAt":"2026-09-03T18:10:26.153Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}