owasp-amass/amass · error

failed to get absolute path for wordlist file: %w

Error message

failed to get absolute path for wordlist file: %w

What it means

In loadBruteForceSettings, each wordlist path is resolved to an absolute path via Config.AbsPathFromConfigDir (relative paths are resolved against the config directory). When that call returns an error, it is wrapped with %w and prefixed with this message. It indicates the wordlist path could not be made absolute — typically because no config directory is set or the path cannot be evaluated from the stored location.

Source

Thrown at config/brute.go:48

	if !c.BruteForcing {
		return nil
	}

	if wordlistPathRaw, ok := bruteforce["wordlists"]; ok {
		wordlistPaths, ok := wordlistPathRaw.([]interface{})
		if !ok {
			return fmt.Errorf("bruteforce wordlist_file is not an array")
		}

		for _, wordlistPathRaw := range wordlistPaths {
			wordlistPath, ok := wordlistPathRaw.(string)
			if !ok {
				return fmt.Errorf("bruteforce wordlist_file item is not a string")
			}

			absPath, err := c.AbsPathFromConfigDir(wordlistPath)
			if err != nil {
				return fmt.Errorf("failed to get absolute path for wordlist file: %w", err)
			}

			wordlist, err := GetListFromFile(absPath)
			if err != nil {
				return fmt.Errorf("unable to load the file in the bruteforce wordlist_file setting: %s: %v", absPath, err)
			}

			c.Wordlist = append(c.Wordlist, wordlist...)
		}
	}

	c.Wordlist = stringset.Deduplicate(c.Wordlist)
	return nil
}

func (c *Config) loadAlterationSettings(cfg *Config) error {
	alterationsRaw, ok := c.Options["alterations"]
	if !ok {

View on GitHub (pinned to 79299dce87)

Solutions

  1. Use an absolute path in the wordlists entry: - /usr/share/wordlists/list.txt
  2. Load the config from an actual file on disk so a config directory is available for relative resolution
  3. Ensure Config.WithConfigDir (or equivalent) is called before loading settings
  4. Verify the path syntax (no stray characters) and that it is a valid filesystem path

Example fix

// before
cfg := &Config{}
cfg.Options = map[string]interface{}{"bruteforce": map[string]interface{}{"wordlists": []interface{}{"list.txt"}}}

// after
cfg := &Config{}
cfg.WithConfigDir("/home/user/.config/amass") // so relative paths resolve
cfg.Options = map[string]interface{}{"bruteforce": map[string]interface{}{"wordlists": []interface{}{"/usr/share/wordlists/list.txt"}}}
Defensive patterns

Strategy: validation

Validate before calling

func ensureResolvableWordlistPath(path, configDir string) error {
	if filepath.IsAbs(path) {
		return nil
	}
	if configDir == "" {
		return fmt.Errorf("relative wordlist path %q requires a config directory", path)
	}
	return nil
}

Type guard

func isAbsolutePath(p string) bool { return filepath.IsAbs(p) }

Try / catch

if err := cfg.LoadSettings(); err != nil {
	var pathErr *fs.PathError
	if strings.Contains(err.Error(), "failed to get absolute path for wordlist file") {
		// switch to absolute paths or set a config dir, then retry
	}
	_ = pathErr
	log.Fatal(err)
}

Prevention

When it happens

Trigger: Calling the config loader with a bruteforce.wordlists entry whose path resolution fails in AbsPathFromConfigDir — e.g. the config was loaded from a string/stdin with no config directory while the wordlist path is relative.

Common situations: Piping a config via stdin or -c - so no config dir exists, but wordlists use relative paths; config directory not initialized before loading; moving a config file to another machine where its recorded base path no longer applies.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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