{
  "id": "go/proto-duplicate-symbol",
  "signature": "protoc-gen-go: error: duplicate symbol \"pb.User\" in file \"user.proto\" and \"user_v2.proto\"",
  "signature_zh": "protoc-gen-go：错误：在文件 \"user.proto\" 和 \"user_v2.proto\" 中重复的符号 \"pb.User\"",
  "regex": "protoc\\-gen\\-go:\\ error:\\ duplicate\\ symbol\\ \"pb\\.User\"\\ in\\ file\\ \"user\\.proto\"\\ and\\ \"user_v2\\.proto\"",
  "domain": "go",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "Two .proto files declare the same fully-qualified message name (same package + message) and are compiled together, causing a symbol collision in generated Go code.",
  "root_cause_type": "generic",
  "root_cause_zh": "两个 .proto 文件声明了相同的完全限定消息名（相同 package + message）并被一起编译，导致生成的 Go 代码中符号冲突。",
  "versions": [
    {
      "version": "protoc-gen-go 1.31+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The collision is on the protobuf fully-qualified name, not the Go package; protoc still errors.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "At link time the generated Go files still declare identical Go types and the Go build fails.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Give each file a distinct proto package:\n// user.proto\npackage pb.v1;\n// user_v2.proto\npackage pb.v2;",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Use buf to detect and lint duplicate symbols across the workspace:\nbuf lint\nbuf breaking --against '.git#branch=main'",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}