{
  "id": "go/grpc-message-size-exceeded",
  "signature": "rpc error: code = ResourceExhausted desc = grpc: received message larger than max (5242881 vs. 4194304)",
  "signature_zh": "rpc 错误：代码 = ResourceExhausted，描述 = grpc：接收到的消息超过最大限制（5242881 > 4194304）",
  "regex": "rpc\\ error:\\ code\\ =\\ ResourceExhausted\\ desc\\ =\\ grpc:\\ received\\ message\\ larger\\ than\\ max\\ \\(5242881\\ vs\\.\\ 4194304\\)",
  "domain": "go",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "The protobuf message exceeds gRPC's default 4 MiB receive limit. Common with large file uploads, batch arrays, or embedded blobs.",
  "root_cause_type": "generic",
  "root_cause_zh": "protobuf 消息超过 gRPC 默认 4 MiB 接收上限。常见于大文件上传、批量数组或内嵌二进制块。",
  "versions": [
    {
      "version": "1.40+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.60+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "gRPC's limit is checked on the uncompressed logical message size in many configs; compression may not help and adds CPU cost.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Deterministic size violation; retries return the same error.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Raise the limit on both client and server:\n// client\nconn, _ := grpc.NewClient(addr,\n  grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(16*1024*1024)))\n// server\nsrv := grpc.NewServer(grpc.MaxRecvMsgSize(16*1024*1024))",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Switch large payloads to streaming RPCs:\nstream, _ := client.Upload(ctx)\nfor _, chunk := range chunks { stream.Send(chunk) }\nstream.CloseAndRecv()",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-03",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}