{"record":{"id":"e309f8c974a37ea0","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-unmarshal-datadog-s-request-with-size-d-b","errorCode":null,"errorMessage":"cannot unmarshal DataDog %s request with size %d bytes: %w","messagePattern":"cannot unmarshal DataDog (.+?) request with size (.+?) bytes: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/protoparser/datadogv2/stream/streamparser.go","lineNumber":43,"sourceCode":"\t\treturn fmt.Errorf(\"cannot decode DataDog protocol data: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc parseData(data []byte, contentType string, callback func(series []datadogv2.Series) error) error {\n\treq := getRequest()\n\tdefer putRequest(req)\n\n\tvar err error\n\tswitch contentType {\n\tcase \"application/x-protobuf\":\n\t\terr = datadogv2.UnmarshalProtobuf(req, data)\n\tdefault:\n\t\terr = datadogv2.UnmarshalJSON(req, data)\n\t}\n\tif err != nil {\n\t\tunmarshalErrors.Inc()\n\t\treturn fmt.Errorf(\"cannot unmarshal DataDog %s request with size %d bytes: %w\", contentType, len(data), err)\n\t}\n\n\trows := 0\n\tseries := req.Series\n\tfor i := range series {\n\t\trows += len(series[i].Points)\n\t\tif *datadogutil.SanitizeMetricName {\n\t\t\tseries[i].Metric = datadogutil.SanitizeName(series[i].Metric)\n\t\t}\n\t}\n\trowsRead.Add(rows)\n\n\tif err := callback(series); err != nil {\n\t\treturn fmt.Errorf(\"error when processing imported data: %w\", err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/protoparser/datadogv2/stream/streamparser.go#L25-L61","documentation":"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.","triggerScenarios":"Thrown at lib/protoparser/datadogv2/stream/streamparser.go:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Match Content-Type to the body: application/json or application/x-protobuf","Fix the payload per the DataDog v2 series schema"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}