{
  "id": "go/proto-duplicate-field-number",
  "signature": "panic: proto: field number 3 in message pb.Order is already used by \"id\"",
  "signature_zh": "panic：proto：消息 pb.Order 中的字段编号 3 已被 \"id\" 使用",
  "regex": "panic:\\ proto:\\ field\\ number\\ 3\\ in\\ message\\ pb\\.Order\\ is\\ already\\ used\\ by\\ \"id\"",
  "domain": "go",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "Two fields in the same proto message were assigned the same field number. This is a proto schema error caught at init time by the generated code.",
  "root_cause_type": "generic",
  "root_cause_zh": "同一个 proto 消息中的两个字段被分配了相同的字段编号。这是 proto 模式错误，在初始化时被生成的代码捕获。",
  "versions": [
    {
      "version": "google.golang.org/protobuf 1.31+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The panic is triggered by the proto field numbers in the generated descriptors, not by Go field names; renaming Go fields does not change the descriptor.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The panic occurs during package init before main runs; recover cannot intercept init-time panics.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.97,
      "how": "Assign unique field numbers in the .proto file and regenerate:\nmessage Order {\n  int64 id = 1;\n  string sku = 2;\n  int32 qty = 3;  // not another 3\n}\n// then: protoc --go_out=. order.proto",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.92,
      "how": "Run buf lint in CI to catch duplicate field numbers before build:\nbuf lint && buf 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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}