GRPC_UNSUPPORTED_COMPRESSION grpc encoding_error ai_generated true

UNIMPLEMENTED: grpc: Decompressor is not installed for grpc-encoding: snappy

ID: grpc/compression-algorithm-not-supported

Also available as: JSON · Markdown · 中文
90%Fix Rate
86%Confidence
1Evidence
2024-05-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
gRPC-go v1.65.0 active
gRPC-java v1.64.0 active
C-core v1.65.0 active

Root Cause

The client sent a message compressed with 'snappy' algorithm, but the server does not have a decompressor registered for that encoding, so it cannot decode the message.

generic

中文

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

Official Documentation

https://grpc.io/docs/languages/go/compression/

Workarounds

  1. 95% success On the server, import the snappy package explicitly. In Go: import _ "google.golang.org/grpc/encoding/snappy". Then rebuild the server binary.
    On the server, import the snappy package explicitly. In Go: import _ "google.golang.org/grpc/encoding/snappy". Then rebuild the server binary.
  2. 85% success On the client, change the compression algorithm to a supported one like gzip or identity: in Go dial option: grpc.WithDefaultCallOptions(grpc.UseCompressor("gzip")).
    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. 90% success 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.
    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.

中文步骤

  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.

Dead Ends

Common approaches that don't work:

  1. 95% fail

    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.

  2. 70% fail

    Disabling compression entirely on the client (grpc.default_compression_algorithm=identity) may break other clients that rely on compression for performance.