{
  "id": "go/protobuf-unknown-field-error",
  "signature": "proto: cannot parse invalid wire-format data",
  "signature_zh": "proto: 无法解析无效的 wire-format 数据",
  "regex": "proto:\\ cannot\\ parse\\ invalid\\ wire\\-format\\ data",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The received bytes are not a valid protobuf wire format, often because the client and server disagree on the message type, or because HTTP/JSON data was sent to a gRPC endpoint expecting binary protobuf.",
  "root_cause_type": "generic",
  "root_cause_zh": "收到的字节不是有效的 protobuf wire format，通常因为客户端与服务端消息类型不一致，或向期待二进制 protobuf 的 gRPC 端点发送了 HTTP/JSON 数据。",
  "versions": [
    {
      "version": "google.golang.org/protobuf 1.30+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The bytes are malformed, not truncated; increasing the size limit does not make invalid wire format valid.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The bytes are binary protobuf, not JSON; protojson will fail with a different parse error.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.8,
      "how": "md, _ := metadata.FromIncomingContext(ctx)\nlog.Printf(\"content-type=%v len=%d\", md.Get(\"content-type\"), len(raw))\nif err := proto.Unmarshal(raw, msg); err != nil {\n    return status.Errorf(codes.InvalidArgument, \"unmarshal: %v\", err)\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "// pin proto version in go.mod and CI check\n// go.mod: require github.com/acme/protos v1.4.2\n// CI: diff generated files against committed ones",
      "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": "2024-06-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}