{"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":"func 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}","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/common/http/transport.go#L130-L166","documentation":"Parse error in parseCertificatesFromPEM: a PEM block typed CERTIFICATE was found but x509.ParseCertificate rejected its DER bytes. %v carries the x509 error; it fires on malformed/unsupported certificate data embedded in an otherwise valid PEM envelope.","triggerScenarios":"Thrown at src/common/http/transport.go:148 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate or re-export the certificate — the DER payload is malformed","Verify the certificate is not truncated or base64-corrupted","Ensure the file contains actual certificates, not keys or CSRs"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","contentChangedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}