owasp-amass/amass · error

failed to parse the %s file: %v

Error message

failed to parse the %s file: %v

What it means

processInputFiles loads list files (wordlists, blacklists, etc.) given via flags into string sets using config.GetListFromFile. When reading or parsing one of those files fails, the underlying error is wrapped as "failed to parse the <name> file: <v>" and input processing aborts, so enumeration cannot start with the given file inputs.

Source

Thrown at internal/enum/files.go:24

import (
	"fmt"
	"log/slog"

	"github.com/caffix/stringset"
	"github.com/owasp-amass/amass/v5/config"
	"github.com/owasp-amass/amass/v5/internal/tools"
	"github.com/owasp-amass/amass/v5/resources"
)

// Obtain parameters from provided input files
func processInputFiles(args *Args) error {
	getList := func(fp []string, name string, s *stringset.Set) error {
		for _, p := range fp {
			if p != "" {
				list, err := config.GetListFromFile(p)
				if err != nil {
					return fmt.Errorf("failed to parse the %s file: %v", name, err)
				}
				s.InsertMany(list...)
			}
		}
		return nil
	}

	if args.Options.BruteForcing {
		if len(args.Filepaths.BruteWordlist) > 0 {
			if err := getList(args.Filepaths.BruteWordlist, "brute force wordlist", args.BruteWordList); err != nil {
				return err
			}
		} else {
			if f, err := resources.GetResourceFile("namelist.txt"); err == nil {
				if list, err := config.GetWordList(f); err == nil {
					args.BruteWordList.InsertMany(list...)
				}
			}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Verify the path exists and is readable: `test -r <path>` or `ls -l <path>`.
  2. Use an absolute path to avoid working-directory surprises.
  3. Ensure the file is a plain text list (one entry per line), not a directory or binary.
  4. Fix read permissions (e.g. chmod +r) if running in restricted environments.

Example fix

// before
-enumeration-words ./wordlists/all.txt   // missing after cwd change
// after
-enumeration-words /opt/amass/wordlists/all.txt
Defensive patterns

Strategy: validation

Validate before calling

func fileReadable(path string) error {
	fi, err := os.Stat(path)
	if err != nil { return fmt.Errorf("cannot stat %s: %w", path, err) }
	if fi.IsDir() { return fmt.Errorf("%s is a directory, not a file", path) }
	f, err := os.Open(path)
	if err != nil { return fmt.Errorf("cannot read %s: %w", path, err) }
	return f.Close()
}

Try / catch

// Go
closer, err := os.Open(p)
if err != nil {
	log.Printf("skipping unreadable list file %s: %v", p, err)
	return err
}
closer.Close()

Prevention

When it happens

Trigger: Calling processInputFiles with a file path that does not exist, is a directory rather than a file, has no read permission, or contains content GetListFromFile cannot parse.

Common situations: Relative wordlist paths that break after changing working directory, missing data files in container images, unreadable files in CI sandboxes, typo'd flag values.

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/86fc01cddad8270d. Report an issue: GitHub.