What the linter checks
The linter reads a schema and reports every point that breaks a rule of the language, with a severity. Tools differ in what they inspect, so a diagnostic code helps. This tool splits codes by area and rule, such as field.numberReservedBand.
Three severities
- error — a compiler or a consuming tool would reject or misbehave.
- warning — it works, but a consuming tool may read it differently or maintenance suffers.
- note — something useful is missing, or the answer depends on the version, as with proto3 explicit optional.
The most frequent errors
| Diagnostic code | Meaning | How to fix |
|---|---|---|
field.numberRange | The number is 0 or above 536,870,911 | Choose one in 1-536,870,911 |
field.numberReservedBand | The number is in 19000-19999 | Move it outside the reserved band |
field.duplicateNumber | Two fields share a number in one message | Assign a new number to one of them |
field.numberReserved | A reserved number is used again | Use another number or remove the reserved entry |
enum.noZero | A proto3 enum has no zero value | Add *_UNSPECIFIED = 0; as the first value |
field.requiredInProto3 | required appears in proto3 | Drop the label and validate in code |
Deletions leave reserved behind
Leaving a deleted field's number free lets a later field take it and mix old data into a new field. reserved 5; and reserved "legacy_ref"; make the compiler refuse the reuse. This tool reports such a reuse as an error, and a deletion protected by reserved as a note in the breaking check.
Names and style
Messages, enums and services should be PascalCase, fields lower_snake_case and enum values UPPER_SNAKE_CASE. A style violation is a warning, so it does not stop a build, but it is the usual reason generated names differ between languages.
Type resolution
A non-scalar field type is looked up among the messages and enums of the same file, from the innermost scope outward, then by a unique suffix match. If nothing matches, field.unknownType is reported.
Zero errors does not mean the schema is safe. The linter checks grammar and rules; it does not judge what the data means or whether it contains personal information.
Questions
Should every warning be removed?
No. Style warnings can stay if the team agrees. A repeated warning is still a sign that the convention should be written down.
Is optional allowed in proto3?
Yes, as explicit presence since 3.15. Use it only where presence must be distinguishable; otherwise the tool reports a note.
Why is a duplicate enum number an error?
When two names share a number, deserialization cannot decide which name it is. If aliases are intended, declare allow_alias.
The field-errors preset contains number range, reserved band, duplicate, reserved reuse and missing enum zero at once.
Written against the Protobuf language guide (proto2 and proto3) and the Protobuf encoding documentation. Every schema, byte string and name here is synthetic.