buf lint "Field name ... should be lower_snake_case" violations in CI
buf lint applies a configured rule set (DEFAULT, or selected categories) to your protos and reports every violation with a file, line, and rule. Any violation fails the step, so a single mis-named field can block the pipeline.
What this error means
buf lint exits non-zero listing violations such as "Field name \"userId\" should be lower_snake_case" or "Enum value name ... should be prefixed with ...". Each line ends with the rule ID.
user/v1/user.proto:8:10:Field name "userId" should be lower_snake_case, such as "user_id".
user/v1/user.proto:14:3:Enum value name "ACTIVE" should be prefixed with "STATUS_".Common causes
Proto names break the configured style rules
The DEFAULT rule set requires lower_snake_case fields, prefixed enum values, and other conventions. Names that predate the rule trip it.
A rule is enabled that the codebase never followed
Adopting buf lint on an existing schema surfaces many violations at once because the code was not written to those rules.
How to fix it
Rename to satisfy the rule
- Read the rule ID at the end of each violation line.
- Rename the field, enum value, or service to the suggested form.
- Re-run
buf lintuntil it reports no violations.
buf lintAdjust the rule set deliberately
If a rule does not fit your API, exclude it in buf.yaml rather than ignoring failures. Keep the rest enforced.
# buf.yaml
version: v1
lint:
use:
- DEFAULT
except:
- ENUM_VALUE_PREFIXHow to prevent it
- Run
buf lintlocally and in a pre-commit hook before pushing. - Adopt lint rules on a new package, then migrate older ones incrementally.
- Configure the rule set in buf.yaml so local and CI results match.