> ## Content Index
> Fetch the complete content index at: https://datajutsu.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Protobuf Field Numbers: What They Are and How to Identify Unknown Fields
- URL: https://datajutsu.com/protobuf-unknown-field-numbers/
- Published: 2026-10-20T17:48:52.000Z
- Updated: 2026-10-20T17:48:52.000Z
- Author: Data Jutsu

You decode a protobuf message and the field comes back as field number 7\. No name, no type, just a number and a value. That is the state of every protobuf you touch without the schema, and the honest answer to 'what is field 7' is: the wire does not say. The number is an index into a .proto you do not have. So you are left doing the other direction of the work - taking what the bytes do show you and inferring the rest.

Here is what the bytes actually show you. Every field is a tag then a value, and the tag packs the field number with a three-bit wire type. There are only four wire types on the wire: varint, fixed 64-bit, length-delimited, and fixed 32-bit. So before you even guess a type, the wire tells you the family. A length-delimited chunk that decodes to clean UTF-8 is almost certainly a string. A length-delimited chunk that itself parses as tag-value pairs consuming the buffer exactly is a nested message, and you can step inside it. A varint in the single digits is a counter or an enum. The catch is that the wire type is not the declared type: int32, int64, uint32, uint64, sint32, sint64, bool, and every enum all ride the same varint wire type, so a raw decoder cannot tell them apart. That ambiguity is real, and it is why a guess has to be checked against actual data, not just the wire.

The way people actually close the gap is to widen the sample. One message is never enough to pin down a type - a varint that happens to be 42 in your sample is 42 or it is the low end of an int64\. You look across many messages of the same kind and see what the field actually does. A varint that stays under 2 to the 31 is probably int32; one that climbs past it is int64\. A length-delimited blob that is always valid base64 or always valid JSON is not a string, it is bytes or a nested structure. A varint that only ever takes a small fixed set of values is an enum, and the distinct values you see are the enum members even if you do not have their names. That is inference across records, and it is the difference between a guess and a working schema. The [reading-a-pb-without-the-schema post](https://datajutsu.com/read-pb-file-without-schema/) covers the single-file forensic pass; this is the same move with more data.

Once you have a working guess, the discipline is to verify it instead of trusting it. Take the schema you reconstructed, encode a message with it, decode it back, and compare field for field against the original. If everything survives, the schema carries the data. If a number shranks, a length changed, or a field appeared that was not there, that is a real mismatch and it names the field that is wrong. That round-trip check is what separates a schema you wrote down from a schema you have proved. The [protobuf to JSON tool](https://proto.datajutsu.com/?ref=datajutsu.com) does this whole loop in the browser: raw decode walks the bytes and recurses into nested messages, a separate tab drafts a .proto from your sample JSON and widens types across records, and a verify step re-encodes and re-decodes to show you exactly which fields hold and which do not. Nothing is uploaded, and a share link puts your exact inputs in the URL so you can hand the stuck case to someone else. I wrote up the wire format properly in [what protobuf actually is](https://datajutsu.com/what-is-protobuf/), and the JSON-mapping gotchas that bite even when you do have the schema in [the conversion errors post](https://datajutsu.com/protobuf-json-conversion-errors/).