# UNIMPLEMENTED: gRPC: 未安装 grpc-encoding: snappy 的解压缩器

- **ID:** `grpc/compression-algorithm-not-supported`
- **领域:** grpc
- **类别:** encoding_error
- **错误码:** `GRPC_UNSUPPORTED_COMPRESSION`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

客户端使用 'snappy' 算法压缩了消息，但服务器未注册该编码的解压缩器，因此无法解码消息。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| gRPC-go v1.65.0 | active | — | — |
| gRPC-java v1.64.0 | active | — | — |
| C-core v1.65.0 | active | — | — |

## 解决方案

1. ```
   On the server, import the snappy package explicitly. In Go: import _ "google.golang.org/grpc/encoding/snappy". Then rebuild the server binary.
   ```
2. ```
   On the client, change the compression algorithm to a supported one like gzip or identity: in Go dial option: grpc.WithDefaultCallOptions(grpc.UseCompressor("gzip")).
   ```
3. ```
   For Java servers, add the dependency: <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-snappy</artifactId> <version>1.64.0</version> </dependency> and it auto-registers.
   ```

## 无效尝试

- **** — Setting environment variable GRPC_GO_COMPRESSION=snappy on the server without importing the snappy package does not register the decompressor; the package must be imported explicitly. (95% 失败率)
- **** — Disabling compression entirely on the client (grpc.default_compression_algorithm=identity) may break other clients that rely on compression for performance. (70% 失败率)
