# Protobuf Wire format is invalid

**URL:** <https://discourse.nodered.org/t/protobuf-wire-format-is-invalid/74956>\
**Category:** General\
**Created:** [9 February 2023 18:26 UTC](https://discourse.nodered.org/t/protobuf-wire-format-is-invalid/74956 "2023-02-09T18:26:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [9 February 2023 18:26 UTC](https://discourse.nodered.org/t/protobuf-wire-format-is-invalid/74956/1 "2023-02-09T18:26:43Z")

</div>

Hello, I'm having trouble decoding a protobuf message. I'm not sure if it how i'm injecting the data or something with my protobuf settings.  
The message is:

```auto
0a0412345678100118b4014001220c080110bced949f0620002a00220c080210bced949f0620002a0022022a0028d0b9959f06300138084801

```

Expected result it:

```auto
Serial: 12345678
Hash: 1
Signal: -103 dBm <= RSSI < -102 dBm
Battery status: OK
Next transmission at: 2/9/2023, 1:51:28 PM
Cloud token:
Measurement period base: 180
Measurement period factor: 1
Transfer reason: First message after sensor reset / Scheduled transmission
Channels:
1 Temperature
Sample offsets:
Start point 0
At 2/9/2023, 11:09:00 AM
2 Humidity
Sample offsets:
Start point 0
At 2/9/2023, 11:09:00 AM
3 No sensor
Sample offsets:
Start point 0
At 12/31/1969, 5:00:00 PM

```

Proto file i'm using is:

> <https://github.com/efento/Proto-files/blob/main/proto_measurements.proto>

When I enter a message type of ProtoMeasurements I get "Wire format is invalid: Error: invalid wire type 4 at offset 93"

Flow:

```auto
[{"id":"64b8974ef8a1661e","type":"decode","z":"d03c03b6d2f91f47","name":"","protofile":"bff6ec07c49408ca","protoType":"ProtoMeasurements","x":680,"y":340,"wires":[["f7308914e2d6f064"]]},{"id":"e3c7fc338fbd2e90","type":"inject","z":"d03c03b6d2f91f47","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[48,97,48,52,49,50,51,52,53,54,55,56,49,48,48,49,49,56,98,52,48,49,52,48,48,49,50,50,48,99,48,56,48,49,49,48,98,99,101,100,57,52,57,102,48,54,50,48,48,48,50,97,48,48,50,50,48,99,48,56,48,50,49,48,98,99,101,100,57,52,57,102,48,54,50,48,48,48,50,97,48,48,50,50,48,50,50,97,48,48,50,56,100,48,98,57,57,53,57,102,48,54,51,48,48,49,51,56,48,56,52,56,48,49]","payloadType":"bin","x":470,"y":340,"wires":[["64b8974ef8a1661e"]]},{"id":"f7308914e2d6f064","type":"debug","z":"d03c03b6d2f91f47","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":900,"y":340,"wires":[]},{"id":"bff6ec07c49408ca","type":"protobuf-file","protopath":"/home/pi/Proto/proto_measurements.proto","watchFile":true,"keepCase":false}]

```

---

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [10 February 2023 22:49 UTC](https://discourse.nodered.org/t/protobuf-wire-format-is-invalid/74956/2 "2023-02-10T22:49:16Z")

</div>

I figured out my problem. Needed to convert the buffer into hex before the protobuf node.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 February 2023 22:49 UTC](https://discourse.nodered.org/t/protobuf-wire-format-is-invalid/74956/3 "2023-02-24T22:49:51Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
