{
  "id": "go/protobuf-message-field-not-set",
  "signature": "proto: message field \"User.name\" is required but not set",
  "signature_zh": "proto: 消息字段 \"User.name\" 是必填的但未设置",
  "regex": "proto:\\ message\\ field\\ \"User\\.name\"\\ is\\ required\\ but\\ not\\ set",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "proto2 required fields (or proto3 with field presence expectations) were not populated before marshaling. Proto3 removed required, so this often comes from proto2 files or validation libraries like protoc-gen-validate.",
  "root_cause_type": "generic",
  "root_cause_zh": "proto2 的 required 字段（或 proto3 中期望字段存在的场景）在序列化前未填充。proto3 移除了 required，因此通常来自 proto2 文件或 protoc-gen-validate 等校验库。",
  "versions": [
    {
      "version": "google.golang.org/protobuf v1.28+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "AllowPartial only suppresses the marshal error; it still emits a message missing the required field, which the peer will reject on unmarshal.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Removing required breaks backward compatibility and shifts the failure to runtime nil dereferences downstream.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "u := &pb.User{Name: \"alice\", Email: \"a@example.com\"}\nif err := proto.CheckInitialized(u); err != nil {\n    return fmt.Errorf(\"invalid user: %w\", err)\n}\nb, err := proto.Marshal(u)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "// user.proto: string name = 1 [(validate.rules).string = {min_len: 1}];\nif err := u.Validate(); err != nil {\n    return status.Errorf(codes.InvalidArgument, \"%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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}