t8y2/dbx · error

decode ZooKeeper protocol version: %w

Error message

decode ZooKeeper protocol version: %w

What it means

Returned by newProtocolZooKeeperClient when the connect-response buffer is too short to decode the first int32 (protocol version). The server's reply is truncated or not a ZooKeeper connect response, indicating a protocol mismatch or a non-ZooKeeper endpoint answering.

Source

Thrown at agents/drivers/hive-go/zookeeper_protocol.go:164

		timeout = defaultConnectTimeout
	}
	client := &protocolZooKeeperClient{connection: connection, timeout: timeout}
	request := &zooKeeperEncoder{}
	request.int32(zooKeeperProtocolVersion)
	request.int64(0)
	request.int32(zooKeeperTimeoutMillis(timeout))
	request.int64(0)
	request.bytes(make([]byte, 16))
	if err := client.writeFrame(request.data()); err != nil {
		return nil, fmt.Errorf("send ZooKeeper connect request: %w", err)
	}
	response, err := client.readFrame()
	if err != nil {
		return nil, fmt.Errorf("read ZooKeeper connect response: %w", err)
	}
	decoder := newZooKeeperDecoder(response)
	if _, err := decoder.int32(); err != nil {
		return nil, fmt.Errorf("decode ZooKeeper protocol version: %w", err)
	}
	if _, err := decoder.int32(); err != nil {
		return nil, fmt.Errorf("decode ZooKeeper session timeout: %w", err)
	}
	sessionID, err := decoder.int64()
	if err != nil {
		return nil, fmt.Errorf("decode ZooKeeper session ID: %w", err)
	}
	if _, err := decoder.bytes(); err != nil {
		return nil, fmt.Errorf("decode ZooKeeper session password: %w", err)
	}
	if sessionID == 0 {
		return nil, zk.ErrSessionExpired
	}
	return client, nil
}

func zooKeeperTimeoutMillis(timeout time.Duration) int32 {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Confirm the port belongs to ZooKeeper (clientPort) and not another protocol
  2. Check for TLS/plain-text mismatch: connecting TLS to a plain port or vice versa truncates the handshake
  3. Try a known-good ZooKeeper client (zkCli) against the same address
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at agents/drivers/hive-go/zookeeper_protocol.go:164 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/2672ca422b7de03d. Report an issue: GitHub.