{
  "id": "go/protobuf-unknown-field-nil-pointer",
  "signature": "panic: runtime error: invalid memory address or nil pointer dereference",
  "signature_zh": "panic: 运行时错误：无效的内存地址或空指针解引用",
  "regex": "panic:\\ runtime\\ error:\\ invalid\\ memory\\ address\\ or\\ nil\\ pointer\\ dereference",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Accessing a submessage field of a proto message that was never set returns nil. Calling a getter is safe, but direct field access on a nil submessage panics.",
  "root_cause_type": "generic",
  "root_cause_zh": "访问从未设置的 proto 消息的子消息字段会返回 nil。调用 getter 是安全的，但对 nil 子消息直接进行字段访问会 panic。",
  "versions": [
    {
      "version": "google.golang.org/protobuf v1.26+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "recover hides the bug and leaves the RPC handler in an inconsistent state; the underlying nil field is still unset.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The peer or the server-side merge may still leave optional submessages unset, so the panic returns whenever the message is absent.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "// BAD: msg.Address.City\n// GOOD:\ncity := msg.GetAddress().GetCity()\nif city == \"\" { city = \"unknown\" }",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.93,
      "how": "if addr := msg.GetAddress(); addr != nil {\n    fmt.Println(addr.Street)\n} else {\n    fmt.Println(\"address not set\")\n}",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-21",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}