{"record":{"id":"c09d8405958d72ca","repo":"JuliusBrussee/caveman","slug":"s-s-contains-no-valid-pem-certificate","errorCode":null,"errorMessage":"%s (%s) contains no valid PEM certificate","messagePattern":"(.+?) \\((.+?)\\) contains no valid PEM certificate","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/chhttp/chhttp.go","lineNumber":191,"sourceCode":"\t\tblock, rest = pem.Decode(rest)\n\t\tif block == nil {\n\t\t\tbreak\n\t\t}\n\t\tif block.Type != \"CERTIFICATE\" {\n\t\t\tcontinue\n\t\t}\n\t\tcert, err := x509.ParseCertificate(block.Bytes)\n\t\tif err != nil {\n\t\t\treturn 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)\n\t\t}\n\t\troots.AddCert(cert)\n\t\tadded++\n\t}\n\tif bytes.Contains(rest, []byte(\"-----BEGIN\")) {\n\t\treturn 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)\n\t}\n\tif added == 0 {\n\t\treturn nil, fmt.Errorf(\"%s (%s) contains no valid PEM certificate\", caFileEnv, path)\n\t}\n\treturn roots, nil\n}\n\n// errTransport fails every request with the configuration error that produced\n// it. A client constructor cannot return an error, and falling back to the\n// default transport would silently trade a rejected TLS configuration for\n// unpinned verification — so the client is built, and refuses to send.\ntype errTransport struct{ err error }\n\nfunc (t errTransport) RoundTrip(*http.Request) (*http.Response, error) { return nil, t.err }\n\n// queryTransport is the shared connection pool behind ClickHouse query clients.\n//\n// http.DefaultTransport keeps only DefaultMaxIdleConnsPerHost (2) idle\n// connections per host, so the 3rd+ concurrent ClickHouse read dials a fresh\n// connection and throws it away on completion — paying a TCP + TLS handshake per\n// query. Report handlers fan several queries out at once and production reads","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/shared/platform/chhttp/chhttp.go#L173-L209","documentation":"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.","triggerScenarios":"Thrown at shared/platform/chhttp/chhttp.go:191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply a bundle containing actual PEM CERTIFICATE blocks","Check that the mounted file is the CA bundle and not a private key, CSR, or config file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}