go build_error ai_generated true

panic: proto: file "common.proto" is already registered

ID: go/grpc-protobuf-import-error

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-03-30First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.30.0 active

Root Cause

The same .proto file is being imported and registered multiple times, often due to circular imports or duplicate imports.

generic

中文

同一个 .proto 文件被多次导入和注册,通常是由于循环导入或重复导入。

Workarounds

  1. 90% success
    Ensure each .proto file is imported only once in the dependency graph; use go module to manage dependencies.
  2. 85% success
    Use protoc with --go_opt=paths=source_relative to avoid duplicate registration.

Dead Ends

Common approaches that don't work:

  1. 70% fail

  2. 60% fail