{"record":{"id":"df9538401fd534fa","repo":"elsa-workflows/elsa-core","slug":"unsupported-protobuf-wire-type-wiretype","errorCode":null,"errorMessage":"Unsupported protobuf wire type '{wireType}'.","messagePattern":"Unsupported protobuf wire type '(.+?)'\\.","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Diagnostics.OpenTelemetry/Ingestion/HttpProtobuf/OtlpHttpProtobufParser.cs","lineNumber":668,"sourceCode":"                    EnsureAvailable(8);\n                    var fixed64 = BinaryPrimitives.ReadUInt64LittleEndian(_remaining[..8]);\n                    _remaining = _remaining[8..];\n                    field = new ProtobufField(number, wireType, fixed64, default, BitConverter.Int64BitsToDouble((long)fixed64));\n                    return true;\n                case ProtobufWireType.LengthDelimited:\n                    var length = checked((int)ReadVarint());\n                    EnsureAvailable(length);\n                    var bytes = _remaining[..length];\n                    _remaining = _remaining[length..];\n                    field = new ProtobufField(number, wireType, default, bytes, default);\n                    return true;\n                case ProtobufWireType.Fixed32:\n                    EnsureAvailable(4);\n                    _remaining = _remaining[4..];\n                    field = new ProtobufField(number, wireType, default, default, default);\n                    return true;\n                default:\n                    throw new InvalidDataException($\"Unsupported protobuf wire type '{wireType}'.\");\n            }\n        }\n\n        private ulong ReadVarint()\n        {\n            ulong value = 0;\n            var shift = 0;\n\n            for (var i = 0; i < 10; i++)\n            {\n                if (_remaining.IsEmpty)\n                    throw new InvalidDataException(\"Unexpected end of protobuf payload.\");\n\n                var b = _remaining[0];\n                _remaining = _remaining[1..];\n                value |= (ulong)(b & 0x7f) << shift;\n\n                if ((b & 0x80) == 0)","sourceCodeStart":650,"sourceCodeEnd":686,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Diagnostics.OpenTelemetry/Ingestion/HttpProtobuf/OtlpHttpProtobufParser.cs#L650-L686","documentation":"The hand-rolled OTLP protobuf parser reads a field tag, decodes the wire type, and switches on it. Protobuf defines wire types 0-5; any other wire type means the buffer is not a valid protobuf message, so the parser throws InvalidDataException naming the offending wire type.","triggerScenarios":"Posting a body to the OTLP HTTP ingestion endpoint that is not valid protobuf encoding (e.g. JSON sent where content-type says protobuf), or a corrupted/truncated payload whose tag byte decodes to wire type > 5.","commonSituations":"Exporter misconfigured with wrong content type (application/json instead of application/x-protobuf); TLS/proxy corruption; sending a text body to the protobuf endpoint for testing with curl.","solutions":["Verify the exporter's protocol and content type are protobuf (application/x-protobuf) matching the HttpProtobuf endpoint.","Validate the payload with a standard protobuf decoder to confirm it is well-formed before export.","Point the exporter at the correct OTLP endpoint protocol (HTTP/protobuf vs gRPC) configured on the server."],"exampleFix":"// before (curl test with wrong format)\ncurl -X POST $endpoint -H 'Content-Type: application/json' -d '{...}'\n\n// after\nOTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf # exporter now sends application/x-protobuf","handlingStrategy":"validation","validationCode":"if (!request.Headers.ContentType?.MediaType!.Equals(\"application/x-protobuf\", StringComparison.OrdinalIgnoreCase) ?? true)\n    return Results.StatusCode(StatusCodes.Status415UnsupportedMediaType);","typeGuard":null,"tryCatchPattern":"try { ParseProtobuf(body); }\ncatch (InvalidDataException ex) { logger.LogWarning(ex, \"Malformed OTLP protobuf payload rejected.\"); }","preventionTips":["Set OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf on exporters pointing at this endpoint.","Never send JSON or raw text to the protobuf ingestion route; test with real protobuf bytes."],"tags":["protobuf","opentelemetry","parsing","malformed-input"],"backgroundTag":"protobuf-unmarshal-failed","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}