{
  "id": "grpc/protobuf-unknown-field-rejected",
  "signature": "INVALID_ARGUMENT: unknown field 42 in message type google.protobuf.Timestamp",
  "signature_zh": "INVALID_ARGUMENT: 消息类型 google.protobuf.Timestamp 中存在未知字段42",
  "regex": "INVALID_ARGUMENT: unknown field \\d+ in message type \\S+",
  "domain": "grpc",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "gRPC server with protobuf strict validation (e.g., 'protojson.DiscardUnknown=false' or gRPC-Web) rejects a request containing an unknown field number in a protobuf message.",
  "root_cause_type": "generic",
  "root_cause_zh": "启用protobuf严格验证（如'protojson.DiscardUnknown=false'或gRPC-Web）的gRPC服务器拒绝包含protobuf消息中未知字段编号的请求。",
  "versions": [
    {
      "version": "protobuf v25.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC v1.64.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC-Web v1.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Adding a new field to the protobuf definition without updating the server binary fails because the server still lacks the field descriptor.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Ignoring the error and retrying the same request repeatedly doesn't change the server's validation; the error persists until the unknown field is removed.",
      "fail_rate": 0.99,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Disabling server-side validation entirely ('protojson.DiscardUnknown=true') may expose the server to malicious payloads or data corruption from future schema changes.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Update the client to remove the unknown field: in protobuf JSON, omit field 42 from the request payload; for gRPC-Web, ensure the protobuf binary doesn't include extra fields by regenerating stubs from the same .proto file.",
      "success_rate": 0.9,
      "how": "Update the client to remove the unknown field: in protobuf JSON, omit field 42 from the request payload; for gRPC-Web, ensure the protobuf binary doesn't include extra fields by regenerating stubs from the same .proto file.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Update the server to accept the unknown field: add field 42 to the protobuf definition and regenerate server code; deploy the updated server binary to match the client schema.",
      "success_rate": 0.85,
      "how": "Update the server to accept the unknown field: add field 42 to the protobuf definition and regenerate server code; deploy the updated server binary to match the client schema.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a custom protobuf parser with 'protojson.UnmarshalOptions{DiscardUnknown: true}' in Go or equivalent in other languages to ignore unknown fields on the server side, but document the risk.",
      "success_rate": 0.75,
      "how": "Use a custom protobuf parser with 'protojson.UnmarshalOptions{DiscardUnknown: true}' in Go or equivalent in other languages to ignore unknown fields on the server side, but document the risk.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "更新客户端以移除未知字段：在protobuf JSON中，从请求负载中省略字段42；对于gRPC-Web，通过从相同.proto文件重新生成存根，确保protobuf二进制文件不包含额外字段。",
    "更新服务器以接受未知字段：将字段42添加到protobuf定义并重新生成服务器代码；部署更新的服务器二进制文件以匹配客户端架构。",
    "使用自定义protobuf解析器，在Go中设置'protojson.UnmarshalOptions{DiscardUnknown: true}'或其他语言中的等效选项，以忽略服务器端的未知字段，但需记录风险。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://protobuf.dev/programming-guides/proto3/#unknowns",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-09-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}