{
  "id": "go/protobuf-marshal-nil-map",
  "signature": "panic: proto: field pb.User.labels contains invalid nil map value",
  "signature_zh": "panic: proto: 字段 pb.User.labels 包含无效的 nil map 值",
  "regex": "panic:\\ proto:\\ field\\ pb\\.User\\.labels\\ contains\\ invalid\\ nil\\ map\\ value",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A proto map field was assigned a map with a nil value (e.g. map[string]*Meta{\"k\": nil}), which the protobuf runtime rejects during marshal.",
  "root_cause_type": "generic",
  "root_cause_zh": "proto map 字段被赋值为包含 nil 值的 map（如 map[string]*Meta{\"k\": nil}），protobuf 运行时在序列化时拒绝该值。",
  "versions": [
    {
      "version": "google.golang.org/protobuf 1.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Swallowing the panic leaves the message unsent and corrupts control flow.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Data loss and hidden bugs; the caller has no signal that data was dropped.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "labels := make(map[string]*pb.Meta)\nfor k, v := range src {\n  if v == nil { continue }\n  labels[k] = v\n}\nmsg.Labels = labels",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "// user.proto\nmessage User {\n  map<string, Meta> labels = 1;\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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-08-25",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}