JuliusBrussee/caveman · error
: load system certificate pool
Error message
%s: load system certificate pool: %w
What it means
rootsWithCAFile could not load the system certificate pool (x509.SystemCertPool failed) while building the combined trust roots for ClickHouse TLS. The CA bundle is appended to the system pool, so without the system half no valid configuration can be produced and the error fails closed.
Solutions
- Check OS certificate store availability and integrity on the host
- Rebuild the container/base image if the system CA store is corrupted or missing
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shared/platform/chhttp/chhttp.go:167 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- SSL/TLS and certificate errors — how TLS handshakes and certificate validation fail.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/4956a7b724305cd3.
Report an issue: GitHub.
Appendix: source
Thrown at shared/platform/chhttp/chhttp.go:167
// Appending (rather than replacing) keeps a public managed endpoint verifiable
// while a private CA is trusted for the internal one.
//
// The bundle is parsed block by block instead of via CertPool.AppendCertsFromPEM,
// which reports success as soon as ONE certificate parses and silently drops the
// rest. A secret mount that is truncated mid-bundle, or corrupt after the first
// entry, would then be half-trusted: the endpoints whose issuer survived keep
// verifying and the ones whose issuer was dropped fail later, at the first
// telemetry flush, looking like a network fault. Any unusable certificate block —
// or a trailing PEM header with no complete block behind it — fails the whole
// bundle CLOSED at boot instead.
func rootsWithCAFile(path string) (*x509.CertPool, error) {
bundle, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("%s: %w", caFileEnv, err)
}
roots, err := x509.SystemCertPool()
if err != nil {
return nil, fmt.Errorf("%s: load system certificate pool: %w", caFileEnv, err)
}
added := 0
rest := bundle
for {
var block *pem.Block
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++View on GitHub (pinned to 766dce6b13)