yorukot/superfile · error
could not find free name for %s after many attempts
Error message
could not find free name for %s after many attempts
What it means
Error "could not find free name for %s after many attempts" thrown in yorukot/superfile.
Source
Thrown at src/internal/function.go:93
counter := 1
//nolint:mnd // 3 = full match + 2 capture groups
if match := suffixRegexp.FindStringSubmatch(name); len(match) == 3 {
name = match[1] // base name without (N)
if num, err := strconv.Atoi(match[2]); err == nil {
counter = num + 1 // start from next number
}
}
// Find first available name
for i := counter; i < 10_000; i++ {
newName := fmt.Sprintf("%s(%d)%s", name, i, ext)
newPath := filepath.Join(dir, newName)
if _, err := os.Stat(newPath); os.IsNotExist(err) {
return newPath, nil
}
}
return "", fmt.Errorf("could not find free name for %s after many attempts", destination)
}
// Count how many file in the directory
func countFiles(dirPath string) (int, error) {
count := 0
err := filepath.Walk(dirPath, func(_ string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() {
count++
}
return nil
})
return count, err
}View on GitHub (pinned to b72f550bc6)
When it happens
Trigger: Thrown at src/internal/function.go:93 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of yorukot/superfile@b72f550bc6 (2026-09-01).
Data as JSON: /api/errors/8f014a710af2adf2.
Report an issue: GitHub.