{
  "id": "go/grpc-already-exists-duplicate-register",
  "signature": "panic: grpc: Server.RegisterService found duplicate service registration for \"pb.UserService\"",
  "signature_zh": "panic: grpc: Server.RegisterService 发现服务 \"pb.UserService\" 重复注册",
  "regex": "panic:\\ grpc:\\ Server\\.RegisterService\\ found\\ duplicate\\ service\\ registration\\ for\\ \"pb\\.UserService\"",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The same gRPC service was registered twice on one grpc.Server, often from init() functions in multiple packages or from calling RegisterXServer twice during setup.",
  "root_cause_type": "generic",
  "root_cause_zh": "同一个 gRPC 服务被注册到同一 grpc.Server 两次，通常来自多个包中的 init() 函数，或初始化时两次调用 RegisterXServer。",
  "versions": [
    {
      "version": "google.golang.org/grpc 1.50+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The server is left in an inconsistent state; subsequent calls may hit the wrong handler or panic again.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Two servers on the same listener cause bind errors or split traffic unpredictably.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "func RegisterAll(s *grpc.Server) {\n    pb.RegisterUserServiceServer(s, &userServer{})\n    pb.RegisterOrderServiceServer(s, &orderServer{})\n}\n// call exactly once from main",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "// delete func init() { pb.RegisterUserServiceServer(...) }\n// replace with explicit call in 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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-14",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}