{
  "id": "go/grpc-protobuf-map-key-type-error",
  "signature": "error: proto: cannot use map field \"metadata\" with key type string: unsupported key type",
  "signature_zh": "错误：proto：无法使用键类型为字符串的映射字段\"metadata\"：不支持的键类型",
  "regex": "error:\\ proto:\\ cannot\\ use\\ map\\ field\\ \"metadata\"\\ with\\ key\\ type\\ string:\\ unsupported\\ key\\ type",
  "domain": "go",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The protobuf map field uses an unsupported key type (e.g., float or bytes) in Go generated code.",
  "root_cause_type": "generic",
  "root_cause_zh": "protobuf映射字段在Go生成的代码中使用了不支持的键类型（例如float或bytes）。",
  "versions": [
    {
      "version": "1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Change the key type in generated Go code manually.",
      "why_fails": "Regeneration will overwrite manual changes.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a repeated field instead of map.",
      "why_fails": "Requires changing the proto schema and all consumers.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use string keys in proto definition.",
      "success_rate": 0.95,
      "how": "map<string, string> metadata = 1;",
      "condition": "",
      "sources": []
    },
    {
      "action": "Encode unsupported keys as string with custom encoding.",
      "success_rate": 0.85,
      "how": "map<string, string> metadata = 1; // encode float as string via strconv.FormatFloat",
      "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.81,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}