#9313·grpc-go

server: cancellation before send compressor setup is reported as Internal

Author: RayanAlsalemiCreated Aug 13, 2026Updated Sep 15, 2026
LabelsP2Type: Bug

What version of gRPC are you using?

google.golang.org/grpc v1.81.0

The behavior is also present in the latest version

What version of Go are you using (go version)?

go version go1.26.3 darwin/arm64

What operating system (Linux, Windows, …) and version?

macOS

What did you do?

The error occurred when a client canceled a compressed RPC after its headers reached the server but before grpc-go configured the response compressor. The client saw Canceled, while stats.End reported:

rpc error: code = Internal desc = grpc: failed to set send compressor: transport: set send compressor called after headers sent or stream done

I reproduced this by pausing server processing after receiving the request headers, canceling the client context, and then allowing compressor setup to continue

What did you expect to see?

  • If the RPC context has ended, compressor setup should return the matching context status: codes.Canceled or codes.DeadlineExceeded.
  • If the context is still active, the compressor setup failure should remain codes.Internal.

What did you see instead?

grpc-go unconditionally returns codes.Internal when SetSendCompress fails