{"record":{"id":"983d036564d8d29b","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-read-sum-983d03","errorCode":null,"errorMessage":"cannot read sum","messagePattern":"cannot read sum","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/protoparser/datadogsketches/parser.go","lineNumber":294,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"cannot read count\")\n\t\t\t}\n\t\t\td.Cnt = cnt\n\t\tcase 3:\n\t\t\tv, ok := fc.Double()\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot read min\")\n\t\t\t}\n\t\t\td.Min = v\n\t\tcase 4:\n\t\t\tv, ok := fc.Double()\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot read max\")\n\t\t\t}\n\t\t\td.Max = v\n\t\tcase 6:\n\t\t\tsum, ok := fc.Double()\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot read sum\")\n\t\t\t}\n\t\t\td.Sum = sum\n\t\tcase 7:\n\t\t\tvar ok bool\n\t\t\td.K, ok = fc.UnpackSint32s(d.K)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot read k\")\n\t\t\t}\n\t\tcase 8:\n\t\t\tvar ok bool\n\t\t\td.N, ok = fc.UnpackUint32s(d.N)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot read n\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/protoparser/datadogsketches/parser.go#L276-L312","documentation":"Case 6 (field 'sum', double) failed: fc.Double() returned ok=false so the parser cannot extract the sum value from the wire. As with the other numeric fields, malformed wire data causes an immediate abort of the whole Sketch message.","triggerScenarios":"Sketch payload where field 6 is truncated or encoded with a non-fixed64 wire type, e.g. by a client that serializes sum incorrectly.","commonSituations":"Custom exporters hand-encoding the Dogsketches protobuf, corrupted traffic through gateways, or mixing protocol versions between sender and VM.","solutions":["Verify the payload with protoc --decode using the datadog agent proto definitions","Correct the client serializer so sum is a double (wire type 1, 8 bytes)","Test with the official Datadog agent pointed at the VM endpoint to isolate sender bugs","Update VictoriaMetrics to the latest version"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate sum is 8-byte fixed64 double in the payload before sending\nbuf := new(bytes.Buffer)\nbinary.Write(buf, binary.LittleEndian, math.Float64bits(sum)) // reference encoding","typeGuard":null,"tryCatchPattern":"if err := stream.Parse(r, callback); err != nil {\n    if strings.Contains(err.Error(), \"cannot read sum\") { /* fix encoder */ }\n}","preventionTips":["Serialize with proto.Marshal, never manual byte assembly","Verify payloads with protoc --decode","Monitor vm_protoparser_rows_unparsed_total{type=\"datadogsketches\"}"],"tags":["protobuf","parsing","datadog","malformed-payload"],"backgroundTag":"protobuf-unmarshal-failed","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"}