probelabs/goreplay · error

missing TLS client certificate in kafka

Error message

missing TLS client certificate in kafka

What it means

NewTLSConfig reports that loading the Kafka TLS client certificate/key pair failed (file missing, unreadable, or pair mismatch), surfacing the underlying load error wrapped with this message before the TLS config is used.

Source

Thrown at kafka.go:74

type KafkaMessage struct {
	ReqURL     string            `json:"Req_URL"`
	ReqType    string            `json:"Req_Type"`
	ReqID      string            `json:"Req_ID"`
	ReqTs      string            `json:"Req_Ts"`
	ReqMethod  string            `json:"Req_Method"`
	ReqBody    string            `json:"Req_Body,omitempty"`
	ReqHeaders map[string]string `json:"Req_Headers,omitempty"`
}

// NewTLSConfig loads TLS certificates
func NewTLSConfig(clientCertFile, clientKeyFile, caCertFile string) (*tls.Config, error) {
	tlsConfig := tls.Config{}

	if clientCertFile != "" && clientKeyFile == "" {
		return &tlsConfig, errors.New("Missing key of client certificate in kafka")
	}
	if clientCertFile == "" && clientKeyFile != "" {
		return &tlsConfig, errors.New("missing TLS client certificate in kafka")
	}
	// Load client cert
	if (clientCertFile != "") && (clientKeyFile != "") {
		cert, err := tls.LoadX509KeyPair(clientCertFile, clientKeyFile)
		if err != nil {
			return &tlsConfig, err
		}
		tlsConfig.Certificates = []tls.Certificate{cert}
	}
	// Load CA cert
	if caCertFile != "" {
		caCert, err := ioutil.ReadFile(caCertFile)
		if err != nil {
			return &tlsConfig, err
		}
		caCertPool := x509.NewCertPool()
		caCertPool.AppendCertsFromPEM(caCert)
		tlsConfig.RootCAs = caCertPool

View on GitHub (pinned to 251e45abd2)

Solutions

  1. Check the cert and key file paths exist and are readable by the gor process
  2. Confirm cert and key match (same key pair, correct PEM encoding)
  3. Regenerate or re-export the client certificate if it is expired or corrupted
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at kafka.go:74 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of probelabs/goreplay@251e45abd2 (2026-09-02). Data as JSON: /api/errors/f44438caa4071dfc. Report an issue: GitHub.