owasp-amass/amass · error

the file is empty

Error message

the file is empty

What it means

GetListFromFile reads a wordlist file (optionally gzip-compressed) and errors out early when file.Stat() reports a size of 0. An empty file can never yield a useful list, so the loader fails fast with this message instead of returning an empty result.

Solutions

  1. Populate the wordlist file with one entry per line.
  2. Point the config/flag at a non-empty wordlist file.
  3. Check file size (ls -l / os.Stat) before running.
  4. Re-download the wordlist if it was truncated.

Example fix

# before
wordlist = /path/to/empty.txt   # 0 bytes
# after
wordlist = /usr/share/wordlists/subdomains.txt
Defensive patterns

Strategy: validation

Validate before calling

info, err := os.Stat(path)
if err != nil { return err }
if info.Size() == 0 { return fmt.Errorf("wordlist %s is empty", path) }

Try / catch

list, err := GetListFromFile(path)
if err != nil {
    if strings.Contains(err.Error(), "the file is empty") {
        // fall back to a default wordlist or abort with a clear message
    }
    return err
}

Prevention

When it happens

Trigger: Calling GetListFromFile (from loadBruteForceSettings, loadAlterationSettings, or CLIWorkflow) with a path to a zero-byte file — created via 'touch wordlist.txt', truncated by a failed download, or never populated.

Common situations: Pointing the wordlist config at an empty placeholder file, a download that failed mid-way, or a volume mount issue that hid the real file contents.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at config/wordlist.go:98

// 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()
	if err != nil {
		return nil, err
	}

	if finfo.Size() < 512 {
		return nil, errors.New("file cannot be checked for compression")

View on GitHub (pinned to 79299dce87)