caddyserver/caddy · error

walking certificates directory %s: %w

Error message

walking certificates directory %s: %w

What it means

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

Source

Thrown at modules/caddytls/folderloader.go:100

			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 {
		// Decode next block so we can see what type it is
		var derBlock *pem.Block
		derBlock, bundle = pem.Decode(bundle)
		if derBlock == nil {
			break
		}

		if derBlock.Type == "CERTIFICATE" {

View on GitHub (pinned to 50e54ee279)

Solutions

  1. Check directory permissions and that the path is a valid directory; see the wrapped error for the failing entry.

When it happens

Trigger: Thrown at modules/caddytls/folderloader.go:100 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15). Data as JSON: /api/errors/7de30dafb488eddb. Report an issue: GitHub.