{"record":{"id":"70d51d50c2bca673","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-read-keyvaluelist-70d51d","errorCode":null,"errorMessage":"cannot read KeyValueList","messagePattern":"cannot read KeyValueList","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/protoparser/opentelemetry/pb/pb_json.go","lineNumber":112,"sourceCode":"\t\t\tdoubleValue, ok := fc.Double()\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot read DoubleValue\")\n\t\t\t}\n\t\t\treturn a.NewNumberFloat64(doubleValue), nil\n\t\tcase 5:\n\t\t\tdata, ok := fc.MessageData()\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot read ArrayValue\")\n\t\t\t}\n\t\t\tarr, err := decodeArrayValueToJSON(data, a, fb)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot decode ArrayValue: %w\", err)\n\t\t\t}\n\t\t\treturn arr, nil\n\t\tcase 6:\n\t\t\tdata, ok := fc.MessageData()\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot read KeyValueList\")\n\t\t\t}\n\t\t\tobj, err := decodeKeyValueListToJSON(data, a, fb)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot decode KeyValueList: %w\", err)\n\t\t\t}\n\t\t\treturn obj, nil\n\t\tcase 7:\n\t\t\tbytesValue, ok := fc.Bytes()\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot read BytesValue\")\n\t\t\t}\n\t\t\tv := fb.formatBase64(bytesValue)\n\t\t\treturn a.NewString(v), nil\n\t\t}\n\t}\n\treturn a.NewNull(), nil\n}\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/protoparser/opentelemetry/pb/pb_json.go#L94-L130","documentation":"In decodeAnyValueToJSON, field 6 of AnyValue is kvlist_value (an embedded KeyValueList message). If fc.MessageData() cannot extract a length-delimited message for that field, the decoder returns 'cannot read KeyValueList'. Like the ArrayValue case, this indicates the on-the-wire encoding does not match the AnyValue schema.","triggerScenarios":"An AnyValue contains field 6 encoded with a non-length-delimited wire type (varint/fixed instead of wire type 2), or the message length prefix extends beyond the buffer.","commonSituations":"Hand-written protobuf in a custom exporter, corrupted or truncated spans/logs in transit, or replaying captured traffic whose buffers were sliced incorrectly.","solutions":["Verify with protoc --decode_raw that kvlist_value is wire type 2 length-delimited.","Correct the producer's encoding or regenerate it with an up-to-date OTLP proto.","Check transport layers for truncation (Content-Length mismatches, proxy buffering limits).","Isolate the failure to the single attribute instead of rejecting the entire request."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure kvlist field is length-delimited before decoding\nnum, typ, n := protowire.ConsumeTag(src)\nif n < 0 || typ != protowire.BytesType {\n    return errors.New(\"kvlist_value is not a length-delimited message\")\n}","typeGuard":"func isMessageField(src []byte) bool {\n    _, typ, n := protowire.ConsumeTag(src)\n    return n >= 0 && typ == protowire.BytesType\n}","tryCatchPattern":null,"preventionTips":["Regenerate protobuf code from current opentelemetry-proto definitions","Validate wire types for oneof members in tests","Guard public OTLP endpoints with payload validation","Avoid manual byte-slicing of received messages"],"tags":["protobuf","malformed-payload","opentelemetry","decoding"],"backgroundTag":"protobuf-wire-type-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"}