Skip to content

Document field number limits, including for MessageSet extensions. - #337

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_1002454621
Oct 19, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_1002454621

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Document field number limits, including for MessageSet extensions.

Regular field numbers are limited to 2^29 - 1 because they share a tag with
the wire type, but MessageSet extension numbers are encoded as a separate
varint, so they are instead limited by the descriptor representation: the
largest number an extension range can contain is 2^31 - 2. Add a Field Numbers
section to go/proto-limits, and note in the proto2 and editions language guides
that max is 2^31 - 2 for MessageSet messages.

Regular field numbers are limited to 2^29 - 1 because they share a tag with
the wire type, but MessageSet extension numbers are encoded as a separate
varint, so they are instead limited by the descriptor representation: the
largest number an extension range can contain is 2^31 - 2. Add a Field Numbers
section to go/proto-limits, and note in the proto2 and editions language guides
that `max` is 2^31 - 2 for MessageSet messages.

PiperOrigin-RevId: 1002463091
@copybara-service
copybara-service Bot merged commit d056cc7 into main Oct 19, 2026
5 checks passed
@copybara-service
copybara-service Bot deleted the test_1002454621 branch October 19, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant