go build_error ai_generated true

恐慌:proto:文件 "common.proto" 已注册

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

ID: go/grpc-protobuf-import-error

其他格式: JSON · Markdown 中文 · English
80%修复率
88%置信度
0证据数
2024-03-30首次发现

版本兼容性

版本状态引入弃用备注
1.30.0 active

根因分析

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

English

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

generic

解决方案

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

无效尝试

常见但无效的做法:

  1. 70% 失败

  2. 60% 失败