JuliusBrussee/caveman · error

( ) contains no valid PEM certificate

Error message

%s (%s) contains no valid PEM certificate

What it means

The configured CA bundle file contains PEM data but no parseable CERTIFICATE blocks — every block was of another type or empty. Zero usable certificates were added, so the bundle provides no trust and is rejected rather than treated as an empty no-op override.

Solutions

  1. Supply a bundle containing actual PEM CERTIFICATE blocks
  2. Check that the mounted file is the CA bundle and not a private key, CSR, or config file
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shared/platform/chhttp/chhttp.go:191 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18). Data as JSON: /api/errors/c09d8405958d72ca. Report an issue: GitHub.

Appendix: source

Thrown at shared/platform/chhttp/chhttp.go:191

		block, rest = pem.Decode(rest)
		if block == nil {
			break
		}
		if block.Type != "CERTIFICATE" {
			continue
		}
		cert, err := x509.ParseCertificate(block.Bytes)
		if err != nil {
			return nil, fmt.Errorf("%s (%s): certificate %d is unparseable, so the bundle is incomplete and must not be half-trusted: %w", caFileEnv, path, added+1, err)
		}
		roots.AddCert(cert)
		added++
	}
	if bytes.Contains(rest, []byte("-----BEGIN")) {
		return nil, fmt.Errorf("%s (%s): trailing PEM block is truncated after %d certificate(s), so the bundle is incomplete and must not be half-trusted", caFileEnv, path, added)
	}
	if added == 0 {
		return nil, fmt.Errorf("%s (%s) contains no valid PEM certificate", caFileEnv, path)
	}
	return roots, nil
}

// errTransport fails every request with the configuration error that produced
// it. A client constructor cannot return an error, and falling back to the
// default transport would silently trade a rejected TLS configuration for
// unpinned verification — so the client is built, and refuses to send.
type errTransport struct{ err error }

func (t errTransport) RoundTrip(*http.Request) (*http.Response, error) { return nil, t.err }

// queryTransport is the shared connection pool behind ClickHouse query clients.
//
// http.DefaultTransport keeps only DefaultMaxIdleConnsPerHost (2) idle
// connections per host, so the 3rd+ concurrent ClickHouse read dials a fresh
// connection and throws it away on completion — paying a TCP + TLS handshake per
// query. Report handlers fan several queries out at once and production reads

View on GitHub (pinned to 766dce6b13)