thanos-io/thanos · error
read dir
Error message
read dir
What it means
Raised in runutil.DeleteAll when os.ReadDir on the target directory fails with an error other than not-exist (which is tolerated and returns nil). Typical causes are permission denied on dir or dir being a non-directory path; deletion aborts before removing anything.
Solutions
- Check permissions on the directory being deleted
- Ensure the path is a directory, not a file or mount point
- Handle the not-exist case — DeleteAll already tolerates it by design
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/runutil/runutil.go:188 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/f631906de514c75c.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/runutil/runutil.go:188
// Prepend the io.Copy error.
merr := errutil.MultiError{}
merr.Add(copyErr)
merr.Add(*err)
*err = merr.Err()
}
// DeleteAll deletes all files and directories inside the given
// dir except for the ignoreDirs directories.
// NOTE: DeleteAll is not idempotent.
func DeleteAll(dir string, ignoreDirs ...string) error {
entries, err := os.ReadDir(dir)
if os.IsNotExist(err) {
return nil
}
if err != nil {
return errors.Wrap(err, "read dir")
}
var groupErrs errutil.MultiError
var matchingIgnores []string
for _, d := range entries {
if !d.IsDir() {
if err := os.RemoveAll(filepath.Join(dir, d.Name())); err != nil {
groupErrs.Add(err)
}
continue
}
// ignoreDirs might be multi-directory paths.
matchingIgnores = matchingIgnores[:0]
ignore := false
for _, ignoreDir := range ignoreDirs {
id := strings.Split(ignoreDir, "/")
if id[0] == d.Name() {View on GitHub (pinned to 35b8b99117)