XTLS/Xray-core · error
failed to create certificate
Error message
failed to create certificate
What it means
Raised in cert Generate when x509.CreateCertificate fails to sign the new leaf certificate with the template, parent cert and keys — typically mismatched parent public/private key pair or invalid template fields.
Solutions
- Ensure parent private key matches parent certificate public key
- Check template validity and key type support
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at common/protocol/tls/cert/cert.go:173 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.
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/2dda13a1ee319525.
Report an issue: GitHub.
Appendix: source
Thrown at common/protocol/tls/cert/cert.go:173
return nil, errors.New("failed to parse parent certificate").Base(err)
}
parentCert = pCert
}
if parentCert.NotAfter.Before(template.NotAfter) {
template.NotAfter = parentCert.NotAfter
}
if parentCert.NotBefore.After(template.NotBefore) {
template.NotBefore = parentCert.NotBefore
}
for _, opt := range opts {
opt(template)
}
derBytes, err := x509.CreateCertificate(rand.Reader, template, parentCert, publicKey(selfKey), parentKey)
if err != nil {
return nil, errors.New("failed to create certificate").Base(err)
}
privateKey, err := x509.MarshalPKCS8PrivateKey(selfKey)
if err != nil {
return nil, errors.New("Unable to marshal private key").Base(err)
}
return &Certificate{
Certificate: derBytes,
PrivateKey: privateKey,
}, nil
}
View on GitHub (pinned to 7d214f8b09)