{"record":{"id":"3c839baeb916d3b7","repo":"caddyserver/caddy","slug":"unable-to-get-relative-path-for-s-w","errorCode":null,"errorMessage":"unable to get relative path for %s: %w","messagePattern":"unable to get relative path for (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddytls/folderloader.go","lineNumber":83,"sourceCode":"\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)\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}","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddytls/folderloader.go#L65-L101","documentation":"Error \"unable to get relative path for %s: %w\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddytls/folderloader.go:83 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the certificate files are inside the configured root directory; paths outside the root cannot be made relative."],"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"}