golang/go · error
tls: server selected unsupported compression format
Error message
tls: server selected unsupported compression format
What it means
TLS 1.2 and earlier carry a compression_method field in the ServerHello. Modern TLS permits only compressionNone (0); any other selection enables CRIME/BREACH-style compression oracle attacks and Go implements no compression, so the handshake is aborted with alertIllegalParameter.
Source
Thrown at src/crypto/tls/handshake_client.go:890
}
func (hs *clientHandshakeState) serverResumedSession() bool {
// If the server responded with the same sessionId then it means the
// sessionTicket is being used to resume a TLS session.
return hs.session != nil && hs.hello.sessionId != nil &&
bytes.Equal(hs.serverHello.sessionId, hs.hello.sessionId)
}
func (hs *clientHandshakeState) processServerHello() (bool, error) {
c := hs.c
if err := hs.pickCipherSuite(); err != nil {
return false, err
}
if hs.serverHello.compressionMethod != compressionNone {
c.sendAlert(alertIllegalParameter)
return false, errors.New("tls: server selected unsupported compression format")
}
supportsPointFormat := false
offeredNonCompressedFormat := false
for _, format := range hs.serverHello.supportedPoints {
if format == pointFormatUncompressed {
supportsPointFormat = true
} else {
offeredNonCompressedFormat = true
}
}
if !supportsPointFormat && offeredNonCompressedFormat {
return false, errors.New("tls: server offered only incompatible point formats")
}
if c.handshakes == 0 && hs.serverHello.secureRenegotiationSupported {
c.secureRenegotiation = true
if len(hs.serverHello.secureRenegotiation) != 0 {View on GitHub (pinned to b6b368adc5)
Solutions
- Treat this as a server-side defect; the server must select null compression.
- Capture the ServerHello to confirm the field value and report to the server operator.
- Investigate the network path for a tampering device.
Defensive patterns
Strategy: try-catch
Type guard
func isUnsupportedCompression(err error) bool {
return err != nil && strings.Contains(err.Error(), "server selected unsupported compression format")
} Try / catch
if _, err := tls.Dial("tcp", addr, cfg); err != nil {
if isUnsupportedCompression(err) {
// Server is non-conformant or path is being tampered with; do not retry.
reportServerDefect(addr, err)
}
} Prevention
- Report server defects that select non-null compression.
- Investigate the path for tampering.
When it happens
Trigger: Server selects DEFLATE (compression method 1) or another non-null method; corrupted ServerHello decoding; malicious server probing for vulnerable clients.
Common situations: Very old or non-conformant TLS stacks; tampered traffic; essentially never seen from modern servers.
Understand the failure class
- SSL/TLS and certificate errors — how TLS handshakes and certificate validation fail.
Related errors
- tls: server echoed TLS 1.3 compatibility session ID in TLS 1
- tls: initial handshake had non-empty renegotiation extension
- tls: incorrect renegotiation extension contents
- tls: server sent non-zero legacy TLS compression method
- tls: invalid outer extensions
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/8a8d2f9f1f2240eb.
Report an issue: GitHub.