# panic：proto：文件 "service.proto" 已注册

- **ID:** `go/grpc-protobuf-version-mismatch`
- **领域:** go
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

同一个 .proto 文件被编译进多个包，导致 init 时重复注册。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.4 | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   Check go.mod for duplicate dependencies and use replace directives to unify versions.
   ```
2. **** (50% 成功率)
   ```
   proto.RegisterFile("custom_service.proto", fileDescriptor)
   ```

## 无效尝试

- **** — Regeneration will still produce the same conflict if imports are duplicated. (80% 失败率)
- **** — Renaming the package doesn't resolve the file registration conflict. (60% 失败率)
