{
  "id": "go/protobuf-unmarshal-invalid-wire-type",
  "signature": "proto: cannot parse invalid wire-format data: illegal tag 0 (wire type 0)",
  "signature_zh": "proto: 无法解析无效的线格式数据：非法标签 0（线类型 0）",
  "regex": "proto:\\ cannot\\ parse\\ invalid\\ wire\\-format\\ data:\\ illegal\\ tag\\ 0\\ \\(wire\\ type\\ 0\\)",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The protobuf binary data is corrupted or not in the expected format. This can happen when the data is truncated, sent over a non-binary channel, or when the wrong message type is used for unmarshaling.",
  "root_cause_type": "generic",
  "root_cause_zh": "protobuf 二进制数据损坏或不是预期的格式。这可能在数据被截断、通过非二进制通道发送或使用错误的消​​息类型进行反序列化时发生。",
  "versions": [
    {
      "version": "1.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The error is not about buffer size but about invalid data structure; increasing buffer won't fix corrupted data.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This leads to silent data corruption and unpredictable behavior downstream.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "// Before unmarshaling, check data length and source\nif len(data) == 0 {\n    return errors.New(\"empty data\")\n}\nvar msg YourMessage\nif err := proto.Unmarshal(data, &msg); err != nil {\n    log.Printf(\"unmarshal failed: %v, data: %x\", err, data)\n    return err\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "// If data is JSON, use protojson\nvar msg YourMessage\nif err := protojson.Unmarshal(jsonData, &msg); err != nil {\n    log.Fatalf(\"protojson unmarshal failed: %v\", err)\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-03-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}