{"record":{"id":"9452acc0d76d2794","repo":"caddyserver/caddy","slug":"unable-to-open-root-directory-s-w","errorCode":null,"errorMessage":"unable to open root directory %s: %w","messagePattern":"unable to open root directory (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddytls/folderloader.go","lineNumber":68,"sourceCode":"\tif !ok {\n\t\trepl = caddy.NewReplacer()\n\t}\n\tfor k, path := range fl {\n\t\tfl[k] = repl.ReplaceKnown(path, \"\")\n\t}\n\treturn nil\n}\n\n// LoadCertificates loads all the certificates+keys in the directories\n// listed in fl from all files ending with .pem. This method of loading\n// certificates expects the certificate and key to be bundled into the\n// same file.\nfunc (fl FolderLoader) LoadCertificates() ([]Certificate, error) {\n\tvar certs []Certificate\n\tfor _, dir := range fl {\n\t\troot, err := os.OpenRoot(dir)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to open root directory %s: %w\", dir, err)\n\t\t}\n\t\terr = filepath.WalkDir(dir, func(fpath string, d fs.DirEntry, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to traverse into path: %s\", fpath)\n\t\t\t}\n\t\t\tif d.IsDir() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif !strings.HasSuffix(strings.ToLower(d.Name()), \".pem\") {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\trel, err := filepath.Rel(dir, fpath)\n\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)","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddytls/folderloader.go#L50-L86","documentation":"Error \"unable to open root directory %s: %w\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddytls/folderloader.go:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the root directory exists and is readable by the Caddy process."],"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"}