{"record":{"id":"efcff77c5e564573","repo":"XTLS/Xray-core","slug":"failed-to-parse-parent-certificate","errorCode":null,"errorMessage":"failed to parse parent certificate","messagePattern":"failed to parse parent certificate","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/protocol/tls/cert/cert.go","lineNumber":155,"sourceCode":"\tserialNumber, err := rand.Int(rand.Reader, serialNumberLimit)\n\tif err != nil {\n\t\treturn nil, errors.New(\"failed to generate serial number\").Base(err)\n\t}\n\n\ttemplate := &x509.Certificate{\n\t\tSerialNumber:          serialNumber,\n\t\tNotBefore:             time.Now().Add(time.Hour * -1),\n\t\tNotAfter:              time.Now().Add(time.Hour),\n\t\tKeyUsage:              x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,\n\t\tExtKeyUsage:           []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},\n\t\tBasicConstraintsValid: true,\n\t}\n\n\tparentCert := template\n\tif parent != nil {\n\t\tpCert, err := x509.ParseCertificate(parent.Certificate)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"failed to parse parent certificate\").Base(err)\n\t\t}\n\t\tparentCert = pCert\n\t}\n\n\tif parentCert.NotAfter.Before(template.NotAfter) {\n\t\ttemplate.NotAfter = parentCert.NotAfter\n\t}\n\tif parentCert.NotBefore.After(template.NotBefore) {\n\t\ttemplate.NotBefore = parentCert.NotBefore\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(template)\n\t}\n\n\tderBytes, err := x509.CreateCertificate(rand.Reader, template, parentCert, publicKey(selfKey), parentKey)\n\tif err != nil {\n\t\treturn nil, errors.New(\"failed to create certificate\").Base(err)","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/common/protocol/tls/cert/cert.go#L137-L173","documentation":"Error \"failed to parse parent certificate\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at common/protocol/tls/cert/cert.go:155 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":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}