owasp-amass/amass · error

error opening the file %s: %v

Error message

error opening the file %s: %v

What it means

After resolving the absolute path, GetListFromFile opens the wordlist file; if os.Open fails (missing file, no permission, it's a directory), this error wraps the OS error together with the path. It is the standard 'couldn't open wordlist' failure.

Source

Thrown at config/wordlist.go:92

			newWordlist = append(newWordlist, words...)
		}
	}

	return newWordlist, nil
}

// GetListFromFile reads a wordlist text or gzip file and returns the slice of words.
func GetListFromFile(path string) ([]string, error) {
	var reader io.Reader

	absPath, err := filepath.Abs(path)
	if err != nil {
		return nil, fmt.Errorf("failed to get absolute path: %v", err)
	}

	file, err := os.Open(absPath)
	if err != nil {
		return nil, fmt.Errorf("error opening the file %s: %v", absPath, err)
	}
	defer func() { _ = file.Close() }()
	reader = file

	if finfo, err := file.Stat(); err == nil && finfo.Size() == 0 {
		return nil, errors.New("the file is empty")
	}

	if gz, err := getGzipReader(file, absPath); err == nil {
		defer func() { _ = gz.Close() }()
		reader = gz
	}

	return GetWordList(reader)
}

func getGzipReader(file *os.File, absPath string) (*gzip.Reader, error) {
	finfo, err := file.Stat()

View on GitHub (pinned to 79299dce87)

Solutions

  1. Verify the file exists at the exact path (ls the path)
  2. Fix the path in your brute-force/alteration config or CLI flag
  3. Check read permissions on the file and traverse permissions on parent dirs
  4. Ensure the path is a file, not a directory

Example fix

// before
GetListFromFile("/usr/share/wordlists/commn.txt")
// after
GetListFromFile("/usr/share/wordlists/common.txt")
Defensive patterns

Strategy: validation

Validate before calling

info, err := os.Stat(path)
if err != nil { return err }
if info.IsDir() { return errors.New("wordlist path is a directory") }
if info.Mode()&0o400 == 0 { return errors.New("wordlist not readable") }

Try / catch

words, err := GetListFromFile(p)
if err != nil {
  if strings.Contains(err.Error(), "error opening the file") {
    // surface the path and check existence/permissions
  }
  return err
}

Prevention

When it happens

Trigger: os.Open returns an error: the file doesn't exist at absPath, permission is denied, the path points to a directory, or the path is empty/garbage.

Common situations: Typo in the wordlist path in brute-force or alteration settings; wordlist not mounted in a container; file present but unreadable by the running user.

Understand the failure class

Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.

Related errors


AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06). Data as JSON: /api/errors/b9b341c5eb4b100a. Report an issue: GitHub.