golang/go · error

tls: client does not support uncompressed connections

Error message

tls: client does not support uncompressed connections

What it means

The client's ClientHello did not include the null (uncompressed) compression method. TLS 1.2 and below only support compressionNone (0); if the client omits it, no common compression can be selected and the server sends illegal_parameter.

Source

Thrown at src/crypto/tls/handshake_server.go:232

func (hs *serverHandshakeState) processClientHello() error {
	c := hs.c

	hs.hello = new(serverHelloMsg)
	hs.hello.vers = c.vers

	foundCompression := false
	// We only support null compression, so check that the client offered it.
	for _, compression := range hs.clientHello.compressionMethods {
		if compression == compressionNone {
			foundCompression = true
			break
		}
	}

	if !foundCompression {
		c.sendAlert(alertIllegalParameter)
		return errors.New("tls: client does not support uncompressed connections")
	}

	hs.hello.random = make([]byte, 32)
	serverRandom := hs.hello.random
	// Downgrade protection canaries. See RFC 8446, Section 4.1.3.
	maxVers := c.config.maxSupportedVersion(roleServer, c.quic != nil)
	if maxVers >= VersionTLS12 && c.vers < maxVers || testingOnlyForceDowngradeCanary {
		if c.vers == VersionTLS12 {
			copy(serverRandom[24:], downgradeCanaryTLS12)
		} else {
			copy(serverRandom[24:], downgradeCanaryTLS11)
		}
		serverRandom = serverRandom[:24]
	}
	_, err := io.ReadFull(c.config.rand(), serverRandom)
	if err != nil {
		c.sendAlert(alertInternalError)
		return err

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Use a standards-compliant TLS client library — every ClientHello must list compression method 0 (null).
  2. If you control the client, ensure the compression_methods vector contains at least [0x00].
  3. If hitting this from a scanner or test harness, treat it as expected; the server is correctly rejecting a malformed hello.
  4. Upgrade the client TLS implementation.

Example fix

// Client-side: ensure the ClientHello always offers null compression.
// Standard Go/Rust/OpenSSL clients do this automatically — no config needed.
// If you built a custom ClientHello encoder, include 0x00:
compressionMethods: []byte{0x00}
Defensive patterns

Strategy: validation

Validate before calling

// Client: ensure null compression is offered. Standard Go clients do this
// automatically. For custom ClientHello encoders:
compressionMethods := []byte{0x00 /* null */}

Try / catch

// Server: this is a malformed-client rejection — log and close.
if err != nil && strings.Contains(err.Error(), "does not support uncompressed connections") {
    log.Warn("malformed ClientHello", "remote", conn.RemoteAddr())
    conn.Close()
}

Prevention

When it happens

Trigger: processClientHello iterates hs.clientHello.compressionMethods looking for compressionNone (0); none was found. The client offered only non-null compressions or sent an empty list.

Common situations: A buggy or malicious client omitting the mandatory null compression method (every conformant ClientHello must include 0). Also seen in fuzz tests, malformed handshakes from custom TLS stacks, or protocol-level scanners.

Understand the failure class

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/f3787571b67b30d0. Report an issue: GitHub.