{
  "id": "grpc/invalid-message-compression",
  "signature": "UNIMPLEMENTED: grpc: unsupported compression algorithm 'snappy' for incoming message",
  "signature_zh": "未实现：gRPC：传入消息不支持的压缩算法 'snappy'",
  "regex": "UNIMPLEMENTED: grpc: unsupported compression algorithm '[A-Za-z0-9]+' for incoming message",
  "domain": "grpc",
  "category": "encoding_error",
  "subcategory": null,
  "root_cause": "The gRPC server received a message compressed with an algorithm (e.g., Snappy) that is not registered in its decompression pipeline, often due to missing dependency or configuration.",
  "root_cause_type": "generic",
  "root_cause_zh": "gRPC 服务器收到一条使用未在其解压缩管道中注册的算法（例如 Snappy）压缩的消息，通常是由于缺少依赖项或配置。",
  "versions": [
    {
      "version": "gRPC v1.52.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC v1.59.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC v1.63.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "protobuf v3.20.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Enabling compression on the client side without server support will cause this error; disabling client compression is a workaround but not a fix.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Upgrading gRPC versions without adding the compression library dependency (e.g., `grpc-snappy`) will still result in the same error.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Manually modifying the message headers to remove compression flags is fragile and may break other clients.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Install the missing compression library on the server: for Python, `pip install grpcio-snappy`; for Go, `go get google.golang.org/grpc/encoding/snappy`.",
      "success_rate": 0.9,
      "how": "Install the missing compression library on the server: for Python, `pip install grpcio-snappy`; for Go, `go get google.golang.org/grpc/encoding/snappy`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Disable compression on the client by setting `grpc.default_compression_algorithm` to `none` in the channel config: `channel = grpc.insecure_channel(target, options=[('grpc.default_compression_algorithm', 'none')])`",
      "success_rate": 0.8,
      "how": "Disable compression on the client by setting `grpc.default_compression_algorithm` to `none` in the channel config: `channel = grpc.insecure_channel(target, options=[('grpc.default_compression_algorithm', 'none')])`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Register the compression algorithm explicitly in the server code: `from grpc_compression import snappy; grpc.handlers._compression.register_compression(snappy)`",
      "success_rate": 0.85,
      "how": "Register the compression algorithm explicitly in the server code: `from grpc_compression import snappy; grpc.handlers._compression.register_compression(snappy)`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在服务器上安装缺失的压缩库：对于 Python，运行 `pip install grpcio-snappy`；对于 Go，运行 `go get google.golang.org/grpc/encoding/snappy`。",
    "在客户端禁用压缩，在通道配置中设置 `grpc.default_compression_algorithm` 为 `none`：`channel = grpc.insecure_channel(target, options=[('grpc.default_compression_algorithm', 'none')])`",
    "在服务器代码中显式注册压缩算法：`from grpc_compression import snappy; grpc.handlers._compression.register_compression(snappy)`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://grpc.io/docs/guides/compression/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2024-04-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}