caddyserver/caddy · error
%s: %w
Error message
%s: %w
What it means
LeafFolderLoader.LoadLeafCertificates wraps x509.ParseCertificate failing on DER bytes converted from a walked .pem file: the file's certificate data is not a valid X.509 certificate; the file path is prefixed to the wrapped parse error.
Solutions
- Check the wrapped error for the specific file that failed and fix its contents or permissions.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at modules/caddytls/leaffolderloader.go:88 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/acfc60175327eaa4.
Report an issue: GitHub.
Appendix: source
Thrown at modules/caddytls/leaffolderloader.go:88
for _, dir := range fl.Folders {
err := filepath.Walk(dir, func(fpath string, info os.FileInfo, err error) error {
if err != nil {
return fmt.Errorf("unable to traverse into path: %s", fpath)
}
if info.IsDir() {
return nil
}
if !strings.HasSuffix(strings.ToLower(info.Name()), ".pem") {
return nil
}
certData, err := convertPEMFilesToDERBytes(fpath)
if err != nil {
return err
}
cert, err := x509.ParseCertificate(certData)
if err != nil {
return fmt.Errorf("%s: %w", fpath, err)
}
certs = append(certs, cert)
return nil
})
if err != nil {
return nil, err
}
}
return certs, nil
}
var (
_ LeafCertificateLoader = (*LeafFolderLoader)(nil)
_ caddy.Provisioner = (*LeafFolderLoader)(nil)
_ caddyfile.Unmarshaler = (*LeafFolderLoader)(nil)
)View on GitHub (pinned to 50e54ee279)