buf "buf.yaml is invalid" configuration error in CI
buf validates buf.yaml and buf.gen.yaml before executing. An invalid config (wrong version, unknown field, or a v1 key under v2) fails immediately with a decode error naming the offending field.
What this error means
buf fails with "Failure: buf.yaml is invalid" or "buf.gen.yaml is invalid" plus a decode message such as an unknown field or a missing/incorrect version.
Failure: buf.gen.yaml is invalid: decode: unknown field "plugin"
(did you mean "plugins"?) at buf.gen.yamlCommon causes
A v1 config used with a v2 buf (or vice versa)
buf v2 changed several keys; using a v1-style layout with version: v2 or omitting the version produces a decode error.
A typo or unknown field
A misspelled key like plugin instead of plugins, or a value of the wrong type, fails schema validation.
How to fix it
Set the correct version and keys
- Declare the
versionthat matches your buf CLI (v2 for buf 1.32+). - Fix the field name the decode error names.
- Re-run buf so the config validates.
version: v2
plugins:
- remote: buf.build/protocolbuffers/go:v1.34.2
out: genMigrate config with buf
Let buf upgrade an older config layout to the current version automatically.
buf config migrateHow to prevent it
- Pin the buf version and keep configs on the matching version.
- Validate config changes with
buf buildlocally before pushing. - Use
buf config migratewhen upgrading buf major versions.