{"record":{"id":"0a65f95ec2493d31","repo":"goharbor/harbor","slug":"failed-to-parse-certificate-v","errorCode":null,"errorMessage":"failed to parse certificate: %v","messagePattern":"failed to parse certificate: (.+?)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"src/common/http/transport.go","lineNumber":148,"sourceCode":"\n// parseCertificatesFromPEM decodes all PEM blocks and parses certificates.\nfunc parseCertificatesFromPEM(pemData string) ([]*x509.Certificate, error) {\n\tvar certs []*x509.Certificate\n\trest := []byte(pemData)\n\n\tfor {\n\t\tvar block *pem.Block\n\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\n\t\tcert, err := x509.ParseCertificate(block.Bytes)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse certificate: %v\", err)\n\t\t}\n\n\t\tcerts = append(certs, cert)\n\t}\n\n\treturn certs, nil\n}\n\n// WithCustomCACert returns a TransportOption that configures custom CA certificates (supports chains)\n// The custom CA certificates are appended to the system CA pool, so both system CAs and custom CAs are trusted.\nfunc WithCustomCACert(caCert string) func(*http.Transport) {\n\treturn func(tr *http.Transport) {\n\t\tcaCert = normalizePEM(caCert)\n\t\tif caCert == \"\" {\n\t\t\tlog.Debugf(\"No custom CA certificate provided; skipping configuration\")\n\t\t\treturn\n\t\t}\n","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/common/http/transport.go#L130-L166","documentation":"Error \"failed to parse certificate: %v\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/common/http/transport.go:148 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}