EENC grpc encoding_error ai_generated true

INTERNAL: grpc: invalid message encoding "custom-enc"

ID: grpc/grpc-invalid-message-encoding

Also available as: JSON · Markdown · 中文
85%Fix Rate
87%Confidence
1Evidence
2024-09-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
gRPC v1.63.0 active
gRPC v1.60.0 active
gRPC v1.57.0 active
Go gRPC v1.62.0 active

Root Cause

Client or server sends a message with a custom Content-Encoding or Message-Encoding that the peer does not support.

generic

中文

客户端或服务器发送了带有对端不支持的 Content-Encoding 或 Message-Encoding 的消息。

Official Documentation

https://grpc.io/docs/guides/compression/#custom-compression

Workarounds

  1. 90% success Register a custom codec on both client and server using the same name, e.g., via `grpc.RegisterCompressor` or `WithDefaultCallOptions(grpc.UseCompressor('custom-enc'))`.
    Register a custom codec on both client and server using the same name, e.g., via `grpc.RegisterCompressor` or `WithDefaultCallOptions(grpc.UseCompressor('custom-enc'))`.
  2. 80% success Fall back to standard gRPC compression (gzip) by removing the custom encoding from the client's call options.
    Fall back to standard gRPC compression (gzip) by removing the custom encoding from the client's call options.

中文步骤

  1. 在客户端和服务器上使用相同名称注册自定义编解码器,例如通过 `grpc.RegisterCompressor` 或 `WithDefaultCallOptions(grpc.UseCompressor('custom-enc'))`。
  2. 通过从客户端调用选项中移除自定义编码,回退到标准 gRPC 压缩(gzip)。

Dead Ends

Common approaches that don't work:

  1. Adding the encoding to server's supported list without implementing the codec 80% fail

    The server will accept the encoding but fail to decompress, causing DATA_LOSS.

  2. Disabling all compression on the client 60% fail

    The error is about unrecognized encoding, not compression being enabled.