{"record":{"id":"7de30dafb488eddb","repo":"caddyserver/caddy","slug":"walking-certificates-directory-s-w","errorCode":null,"errorMessage":"walking certificates directory %s: %w","messagePattern":"walking certificates directory (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddytls/folderloader.go","lineNumber":100,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to get relative path for %s: %w\", fpath, err)\n\t\t\t}\n\n\t\t\tbundle, err := root.ReadFile(rel)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcert, err := tlsCertFromCertAndKeyPEMBundle(bundle)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s: %w\", fpath, err)\n\t\t\t}\n\n\t\t\tcerts = append(certs, Certificate{Certificate: cert})\n\t\t\treturn nil\n\t\t})\n\t\t_ = root.Close()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"walking certificates directory %s: %w\", dir, err)\n\t\t}\n\t}\n\treturn certs, nil\n}\n\nfunc tlsCertFromCertAndKeyPEMBundle(bundle []byte) (tls.Certificate, error) {\n\tcertBuilder, keyBuilder := new(bytes.Buffer), new(bytes.Buffer)\n\tvar foundKey bool // use only the first key in the file\n\n\tfor {\n\t\t// Decode next block so we can see what type it is\n\t\tvar derBlock *pem.Block\n\t\tderBlock, bundle = pem.Decode(bundle)\n\t\tif derBlock == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tif derBlock.Type == \"CERTIFICATE\" {","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddytls/folderloader.go#L82-L118","documentation":"Error \"walking certificates directory %s: %w\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddytls/folderloader.go:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check directory permissions and that the path is a valid directory; see the wrapped error for the failing entry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}