{"record":{"id":"f40b31c0b285b223","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-read-explicitbounds","errorCode":null,"errorMessage":"cannot read ExplicitBounds","messagePattern":"cannot read ExplicitBounds","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/protoparser/opentelemetry/pb/pb.go","lineNumber":1180,"sourceCode":"\t\t\thctx.count, ok = fc.Fixed64()\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot read Count\")\n\t\t\t}\n\t\tcase 5:\n\t\t\thctx.sum, 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\thctx.hasSum = true\n\t\tcase 6:\n\t\t\thctx.bucketCounts, ok = fc.UnpackFixed64s(hctx.bucketCounts)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot read BucketCounts\")\n\t\t\t}\n\t\tcase 7:\n\t\t\thctx.explicitBounds, ok = fc.UnpackDoubles(hctx.explicitBounds)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot read ExplicitBounds\")\n\t\t\t}\n\t\tcase 10:\n\t\t\thctx.flags, ok = fc.Uint32()\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot read Flags\")\n\t\t\t}\n\t\t}\n\t}\n\n\thctx.pushSamples(dctx)\n\n\treturn nil\n}\n\ntype histogramDataPointContext struct {\n\ttimestamp      uint64\n\tcount          uint64\n\tsum            float64","sourceCodeStart":1162,"sourceCodeEnd":1198,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/protoparser/opentelemetry/pb/pb.go#L1162-L1198","documentation":"This error is returned while decoding an OTLP HistogramDataPoint: field 7 (explicit_bounds, repeated double) failed to be unpacked from the protobuf wire format by easyproto's UnpackDoubles. It means the bytes on the wire for this field are malformed or truncated - the wire type does not match the expected packed/unpacked double encoding, or the payload ends mid-field. The parser is strict and aborts the whole request rather than skipping the bad field.","triggerScenarios":"Calling lib/protoparser/opentelemetry Unmarshal (or the /opentelemetry/v1/metrics ingestion path in VictoriaMetrics) with an ExportMetricsServiceRequest whose HistogramDataPoint contains a field 7 with a wire type other than length-delimited (packed) or 64-bit (unpacked), or a truncated double payload.","commonSituations":"A sender built with a mismatched or hand-rolled protobuf encoder; a proxy/LB or body-size limit truncating the request body mid-message; bytes corrupted by wrong Content-Encoding (e.g. body not actually gzipped/uncompressed as declared); OTLP/HTTP sent to an OTLP/gRPC-style endpoint or vice versa causing payload mangling.","solutions":["Re-serialize the metrics payload with a standard OTLP exporter/protobuf library and retry the request.","Verify the client's Content-Encoding/Content-Type headers match the actual body encoding (gzip vs plain protobuf) and that no intermediary truncates the body (check request body size limits).","Capture the failing request body and decode it with protoc --decode opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest to find the malformed field.","Upgrade both the sender SDK and VictoriaMetrics/protoparser to matching versions, since proto schema drift can change field encodings."],"exampleFix":"// before: client sends gzip-declared body but writes uncompressed bytes\nreq.Header.Set(\"Content-Encoding\", \"gzip\")\nbody := marshalOTLP(req)\n// after\nvar buf bytes.Buffer\ngz := gzip.NewWriter(&buf)\ngz.Write(marshalOTLP(req))\ngz.Close()\nreq.Body = io.NopCloser(&buf)","handlingStrategy":"try-catch","validationCode":"// before sending OTLP bytes, sanity-check they decode with the reference marshaller\nvar req pb.ExportMetricsServiceRequest\nif err := proto.Unmarshal(body, &req); err != nil {\n    return fmt.Errorf(\"invalid OTLP payload: %w\", err)\n}","typeGuard":"func isDecodeError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"cannot read ExplicitBounds\")\n}","tryCatchPattern":"err := parser.Unmarshal(req.Body, ...)\nif err != nil {\n    if strings.Contains(err.Error(), \"cannot read\") {\n        http.Error(w, \"malformed OTLP protobuf payload\", http.StatusBadRequest)\n        return\n    }\n    http.Error(w, err.Error(), http.StatusInternalServerError)\n}","preventionTips":["Always build payloads with the official opentelemetry-proto marshaller, never hand-rolled encoders","Keep Content-Type/Content-Encoding headers consistent with the actual body encoding","Set proxy/ingress body size limits above your largest telemetry batch","Pin matching opentelemetry-proto versions on client SDK and server"],"tags":["protobuf","opentelemetry","wire-format","metrics"],"backgroundTag":"protobuf-decode-failure","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"}