Skip to content
Latchkey

buf generate "unable to find protoc plugin" in CI

For local plugins, buf generate runs a binary named protoc-gen-<name> from PATH. When buf.gen.yaml names a plugin whose binary is not installed on the runner, buf reports it cannot find the plugin and aborts.

What this error means

buf generate fails with "unable to find protoc plugin for name \"go\"" or "could not find protoc plugin \"protoc-gen-connect-go\"" before any code is written.

buf
Failure: plugin go: unable to find protoc plugin for name "go": exec: "protoc-gen-go": executable file not found in $PATH

Common causes

The local plugin binary is not installed

buf.gen.yaml uses plugin: go (a local plugin), but protoc-gen-go was never installed on the runner.

Installed but GOPATH/bin not on PATH

The plugin exists under $(go env GOPATH)/bin, which the buf generate step does not have on PATH.

How to fix it

Install the named plugins and expose PATH

  1. Install each protoc-gen-<name> referenced in buf.gen.yaml.
  2. Add $(go env GOPATH)/bin to PATH for the generate step.
  3. Re-run buf generate.
Terminal
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
buf generate

Use remote plugins to avoid local installs

Reference plugins hosted on the Buf Schema Registry so no local binary is required on the runner.

buf.gen.yaml
# buf.gen.yaml
version: v1
plugins:
  - plugin: buf.build/protocolbuffers/go
    out: gen/go
    opt: paths=source_relative

How to prevent it

  • Install all local codegen plugins before buf generate.
  • Add $(go env GOPATH)/bin to GITHUB_PATH in setup.
  • Prefer remote plugins so CI needs no local plugin binaries.

Frequently asked questions

What causes "buf "could not find protoc plugin""?
buf.gen.yaml uses plugin: go (a local plugin), but protoc-gen-go was never installed on the runner.
How do I fix buf "could not find protoc plugin"?
Install the named plugins and expose PATH

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card