{
  "id": "go/protobuf-json-unknown-field",
  "signature": "proto: (line 1:14): unknown field \"userName\"",
  "signature_zh": "proto: （第 1 行第 14 列）：未知字段 \"userName\"",
  "regex": "proto:\\ \\(line\\ 1:14\\):\\ unknown\\ field\\ \"userName\"",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "protojson.Unmarshal encountered a JSON key that does not match any field in the target message. protobuf JSON uses either the proto field name (snake_case) or the lowerCamelCase JSON name; using an unrelated casing fails.",
  "root_cause_type": "generic",
  "root_cause_zh": "protojson.Unmarshal 遇到了与目标消息任何字段都不匹配的 JSON 键。protobuf JSON 使用 proto 字段名（snake_case）或 lowerCamelCase 的 JSON 名；使用不相关的命名会失败。",
  "versions": [
    {
      "version": "google.golang.org/protobuf 1.28+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "encoding/json ignores protobuf-specific semantics (oneofs, well-known types) and produces incorrect values.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Fragile and breaks for nested messages, repeated fields, and oneofs; also loses type info.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "opts := protojson.UnmarshalOptions{DiscardUnknown: true}\nif err := opts.Unmarshal(data, msg); err != nil {\n    return err\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "// .proto: string user_name = 1;\n// JSON accepts either:\n// {\"user_name\":\"alice\"}  or  {\"userName\":\"alice\"}",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}