{"record":{"id":"4fd86c5a6b0d69b8","repo":"temporalio/temporal","slug":"failed-to-parse-x509-certificate-w","errorCode":null,"errorMessage":"failed to parse x509 certificate: %w","messagePattern":"failed to parse x509 certificate: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/rpc/encryption/local_store_cert_provider.go","lineNumber":461,"sourceCode":"\t\tif ca == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tcaBytes, err := getBytes(ca)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to decode ca cert: %w\", err)\n\t\t}\n\n\t\tif caPool == nil {\n\t\t\tcaPool = x509.NewCertPool()\n\t\t}\n\t\tif !caPool.AppendCertsFromPEM(caBytes) {\n\t\t\treturn nil, nil, errors.New(\"unknown failure constructing cert pool for ca\")\n\t\t}\n\n\t\tcert, err := parseCert(caBytes)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to parse x509 certificate: %w\", err)\n\t\t}\n\t\tcerts = append(certs, cert)\n\t}\n\treturn caPool, certs, nil\n}\n\n// logic borrowed from tls.X509KeyPair()\nfunc parseCert(bytes []byte) (*x509.Certificate, error) {\n\n\tvar certBytes [][]byte\n\tfor {\n\t\tvar certDERBlock *pem.Block\n\t\tcertDERBlock, bytes = pem.Decode(bytes)\n\t\tif certDERBlock == nil {\n\t\t\tbreak\n\t\t}\n\t\tif certDERBlock.Type == \"CERTIFICATE\" {\n\t\t\tcertBytes = append(certBytes, certDERBlock.Bytes)","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/rpc/encryption/local_store_cert_provider.go#L443-L479","documentation":"Error \"failed to parse x509 certificate: %w\" thrown in temporalio/temporal.","triggerScenarios":"Thrown at common/rpc/encryption/local_store_cert_provider.go:461 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":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}