goharbor/harbor · error
failed to parse certificate: %v
Error message
failed to parse certificate: %v
What it means
Error "failed to parse certificate: %v" thrown in goharbor/harbor.
Source
Thrown at src/common/http/transport.go:148
// parseCertificatesFromPEM decodes all PEM blocks and parses certificates.
func parseCertificatesFromPEM(pemData string) ([]*x509.Certificate, error) {
var certs []*x509.Certificate
rest := []byte(pemData)
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("failed to parse certificate: %v", err)
}
certs = append(certs, cert)
}
return certs, nil
}
// WithCustomCACert returns a TransportOption that configures custom CA certificates (supports chains)
// The custom CA certificates are appended to the system CA pool, so both system CAs and custom CAs are trusted.
func WithCustomCACert(caCert string) func(*http.Transport) {
return func(tr *http.Transport) {
caCert = normalizePEM(caCert)
if caCert == "" {
log.Debugf("No custom CA certificate provided; skipping configuration")
return
}
View on GitHub (pinned to 7b2fd08cc5)
When it happens
Trigger: Thrown at src/common/http/transport.go:148 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.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/0a65f95ec2493d31.
Report an issue: GitHub.