{
  "id": "go/proto-unknown-field-json",
  "signature": "proto: (line 1:2): unknown field \"user_id\" in pb.User",
  "signature_zh": "proto：（第 1 行第 2 列）：pb.User 中未知字段 \"user_id\"",
  "regex": "proto:\\ \\(line\\ 1:2\\):\\ unknown\\ field\\ \"user_id\"\\ in\\ pb\\.User",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "protojson.Unmarshal encountered a JSON field not present in the target message. Common when JSON uses snake_case but the proto field uses camelCase (protojson default), or the JSON came from a different schema version.",
  "root_cause_type": "generic",
  "root_cause_zh": "protojson.Unmarshal 遇到目标消息中不存在的 JSON 字段。常见于 JSON 使用 snake_case 而 proto 字段使用 camelCase（protojson 默认），或 JSON 来自不同 schema 版本。",
  "versions": [
    {
      "version": "google.golang.org/protobuf 1.26+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "protojson returns a partial message; downstream code sees zero values and produces wrong results.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Generated protobuf structs do not honor json tags; protojson uses its own field-name mapping.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use protojson with explicit options:\nopts := protojson.UnmarshalOptions{\n    DiscardUnknown: true,\n}\nerr := opts.Unmarshal(data, msg)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Configure the emitter/unmarshaler for the naming convention you expect:\nprotojson.UnmarshalOptions{Resolver: ...}\n// and emit with UseProtoNames to force snake_case:\nm := protojson.MarshalOptions{UseProtoNames: true}",
      "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.87,
  "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": []
}