caddyserver/caddy · error

%s: %w

Error message

%s: %w

What it means

Error "%s: %w" thrown in caddyserver/caddy.

Source

Thrown at modules/caddytls/folderloader.go:92

			if d.IsDir() {
				return nil
			}
			if !strings.HasSuffix(strings.ToLower(d.Name()), ".pem") {
				return nil
			}

			rel, err := filepath.Rel(dir, fpath)
			if err != nil {
				return fmt.Errorf("unable to get relative path for %s: %w", fpath, err)
			}

			bundle, err := root.ReadFile(rel)
			if err != nil {
				return err
			}
			cert, err := tlsCertFromCertAndKeyPEMBundle(bundle)
			if err != nil {
				return fmt.Errorf("%s: %w", fpath, err)
			}

			certs = append(certs, Certificate{Certificate: cert})
			return nil
		})
		_ = root.Close()
		if err != nil {
			return nil, fmt.Errorf("walking certificates directory %s: %w", dir, err)
		}
	}
	return certs, nil
}

func tlsCertFromCertAndKeyPEMBundle(bundle []byte) (tls.Certificate, error) {
	certBuilder, keyBuilder := new(bytes.Buffer), new(bytes.Buffer)
	var foundKey bool // use only the first key in the file

	for {

View on GitHub (pinned to 50e54ee279)

Solutions

  1. Check the wrapped error for the specific file that failed and fix its contents or permissions.

When it happens

Trigger: Thrown at modules/caddytls/folderloader.go:92 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/8f7d59fd6f09504c. Report an issue: GitHub.