> ## 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.

# A Protobuf Group Is a Message Without a Length (and the Parser Still Wants the Rule Word)
- URL: https://datajutsu.com/protobuf-groups-wire-format/
- Published: 2026-10-22T15:32:54.000Z
- Updated: 2026-10-22T15:32:54.000Z
- Author: Data Jutsu

A group is the one field kind in protobuf that delimits itself. Every message field you have ever decoded is a tag, a length, and a payload; a group is a tag, an open, a run of inner fields, and a close. I put a Detail group at number two in a proto2 message and watched the bytes. The sibling int went out as 0809, then the group started with 13, the inner fields followed as 0801 and 1202 6869, and the group closed with 14\. That 13 is field two, wire type three. That 14 is field two, wire type four. Those are the only two wire types in the whole format, and a group is the only thing that produces them, which is why a no-schema reader is the one place a group is unmistakable.

The size story is where the usual claim falls apart. I encoded the group at number two holding x=1 and y=hi, and an ordinary message field at number two holding the same inner message, and they came out the same total length. The group spends two tag bytes, the open and the close. The message field spends a tag plus a length varint, and for this payload that is also two bytes. So a group is not smaller than the message it wraps, it is the same length with a different shape of boundary. The difference is that the bytes are closed off by a matching end tag instead of declared by a number, so a decoder has to walk forward until it sees the close, not jump ahead by a count.

That boundary kind is part of the wire type, and a schema decoder enforces it. I took the exact group bytes and decoded them with a schema that declares a plain optional message at number two. It threw. It read the start tag as a length-delimited field and ran out of room before the payload fit. I took the message-field bytes and decoded them with the group schema. It threw invalid wire type, because it wanted wire type three and found two. Same field number, same inner bytes, and the two do not swap: the marker is checked. The JSON out of a decoded group is the same nested object a message field gives, a detail key with x and y inside it, so once you are past the wire the difference is invisible. It lives entirely in how the boundary is written, and the wire is the only place that is visible.

The behavior that will actually bite you is in the parser, not the encoder. This tool's parser needs the rule word on a group. It accepts optional group Detail = 2 and it rejects the bare form, group Detail = 2, with illegal token 'group', and it rejects the old-style capital form, Group Detail = 2, with illegal token 'Group'. protoc forgives those older spellings, so a file that compiles in protoc can die in a JavaScript tool on the group line. It is the same trap as the import alias: a line the compiler accepts that the parser does not, and the error names the token, so you can find it in the file.

The small behaviors are the presence ones. An unset group writes zero bytes, exactly like any unset proto2 optional, so the format cannot say the group was absent unless you set it. An empty but present group writes two bytes, the open and the close with nothing between, so the format can say the group was there and carried nothing, and that is presence working. Rename the group and keep number two and the bytes are identical, the field-number rule holds for groups exactly like it holds for everything else. A repeated group is the open, the inner fields, the close, written back to back, field three giving 1b through 1c per item, with no packing involved. I ran all of it in the browser with no protoc.

Paste the file and the type resolves on every tab of [proto.datajutsu.com](https://proto.datajutsu.com/?ref=datajutsu.com), and the raw-decode tab is where a group shows itself: field two appearing as wire type three, its inner fields, then field two as wire type four, the two markers nothing else in the format produces. The [wire-format post](https://datajutsu.com/how-protobuf-wire-format-works/) is where the four ordinary wire types are named, and this is the field that uses the two they left out. The [import-alias post](https://datajutsu.com/protobuf-import-alias-pitfalls/) covers the other line the parser will not forgive, and the two together are the ones that make a protoc-clean file die in a browser tool.