{
  "id": "grpc/protobuf-field-mismatch",
  "signature": "INTERNAL: grpc: error while parsing response: field 5 has type int64 but message expects string",
  "signature_zh": "内部错误：解析响应时出错：字段 5 类型为 int64 但消息期望为字符串",
  "regex": "INTERNAL: grpc: error while parsing response: field \\d+ has type \\w+ but message expects \\w+",
  "domain": "grpc",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Server and client have mismatched Protobuf definitions for the same RPC, where a field type differs (e.g., server sends int64 but client expects string).",
  "root_cause_type": "generic",
  "root_cause_zh": "服务器和客户端对同一 RPC 的 Protobuf 定义不匹配，字段类型不同（例如服务器发送 int64 但客户端期望字符串）。",
  "versions": [
    {
      "version": "protobuf v3.21.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "protobuf v4.25.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC v1.62.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If the .proto file itself is outdated, regenerated stubs still have the wrong types; the root cause is the definition mismatch.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "gRPC uses strict Protobuf parsing; custom deserializers are not supported and will cause further parsing errors.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Version mismatch is not the issue; the .proto file content is what defines the field types.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Synchronize the .proto file between server and client: run `diff server.proto client.proto` to identify field type differences, then update the incorrect one. Recompile both sides with `protoc --proto_path=. --go_out=. *.proto` (or equivalent for your language).",
      "success_rate": 0.95,
      "how": "Synchronize the .proto file between server and client: run `diff server.proto client.proto` to identify field type differences, then update the incorrect one. Recompile both sides with `protoc --proto_path=. --go_out=. *.proto` (or equivalent for your language).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a versioned schema registry (e.g., Confluent Schema Registry) to enforce that both sides use the same Protobuf schema version for the RPC.",
      "success_rate": 0.85,
      "how": "Use a versioned schema registry (e.g., Confluent Schema Registry) to enforce that both sides use the same Protobuf schema version for the RPC.",
      "condition": "",
      "sources": []
    },
    {
      "action": "As a temporary workaround, change the client field to use `google.protobuf.Any` to accept any type, then manually cast in application code.",
      "success_rate": 0.7,
      "how": "As a temporary workaround, change the client field to use `google.protobuf.Any` to accept any type, then manually cast in application code.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "同步服务器和客户端的 .proto 文件：使用 `diff server.proto client.proto` 找出字段类型差异，更新错误的一方。使用 `protoc` 重新编译两端。",
    "使用版本化的模式注册表（如 Confluent Schema Registry），强制 RPC 两端使用相同的 Protobuf 模式版本。",
    "临时将客户端字段改为 `google.protobuf.Any` 以接受任意类型，然后在应用代码中手动转换。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://protobuf.dev/programming-guides/proto3/",
  "official_doc_section": null,
  "error_code": "GRPC_PROTOBUF_FIELD_MISMATCH",
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2025-02-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}