Protobuf field guide

Find the layer that is failing.

A decoding error is not always a bad protocol definition. Check the text encoding, message boundaries and schema separately before changing the payload.

First, validate Hex or Base64.

Hex needs two hexadecimal digits per byte. The workspace accepts whitespace and an optional leading 0x prefix. Base64 uses a different alphabet and, in this tool, requires a length divisible by four with padding where needed.

Do not paste a JSON string with its surrounding quotes, an HTTP header, or an entire packet dump into a binary input. Extract the actual payload first.

Byte walkthrough
Valid Hex:       08 96 01
Same in Base64:  CJYB
Truncated Hex:   08 96
Invalid Hex:     08 9G 01

Then, locate a complete message.

The bytes 08 96 begin a field-1 varint whose continuation bit says another byte follows. Stopping there makes the value incomplete. A truncated message can result from copying only part of a response or reading the wrong length.

A transport can add bytes around Protobuf. A gRPC message has a five-byte message header before the payload; a stream can contain multiple framed messages. Compression may also apply. This workspace expects the Protobuf payload itself, not a full gRPC or HTTP body.

Byte walkthrough
Example gRPC message (uncompressed):
00 00 00 00 03 | 08 96 01

00             compression flag
00 00 00 03    payload length: 3 bytes
08 96 01       Protobuf payload to decode

Check the message type and imports.

Load the definition used by the sender and select its exact message type, including the package. A successful parse with a different message type is not evidence that the interpretation is correct: unknown fields may be skipped and some wire representations overlap.

Import related files together. The workspace resolves imports against the importing file, the supplied root paths and a shared uploaded top-level directory. Missing or ambiguous imports produce an error instead of selecting a file by a matching filename suffix.

  • Confirm the package and fully qualified message name.
  • Match field numbers and declared types, not just field names.
  • Use a compatible schema version from the producer.
  • If the sender uses Any, obtain the definitions for the embedded types as well.

Match the symptom to the next check.

SymptomLikely checkNext action
Odd-length Hex or invalid charactersInput representationRemove wrappers and copy complete byte pairs.
Out of range / unexpected endTruncation, framing or lengthCompare the captured byte count with the actual payload boundary.
Invalid wire typeWrong starting offset, corrupt bytes or framingInspect the first field tag and remove transport headers.
Unknown type or missing importSchema loadingUpload the dependency tree and resolve imports.
Empty or surprising JSONWrong message type or defaultsCheck the exact sender schema; inspect unknown fields without a schema.
Encoding fails after editing JSONJSON type mappingCheck int64 strings, enum values, Base64 bytes and oneof members.

Compare with a known-good message.

Before investigating a large payload, reproduce the tiny example below. If it works, your browser tool is processing a known valid message and you can narrow the investigation to your actual input or schema.

If the real message still fails, keep an unmodified copy and reduce a separate sample. Avoid deleting arbitrary bytes from a length-delimited field: its encoded length must agree with the bytes that follow.

Protocol definition & example
syntax = "proto3";
message Example { uint32 id = 1; }

// Decode Hex 08 96 01 as Example.
// Expected id: 150

Reference material

Use the specifications for details beyond these examples.