owasp-amass/amass · error

alterations wordlist_file item is not a string

Error message

alterations wordlist_file item is not a string

What it means

loadAlterationSettings reads the 'alterations.wordlist_file' option from the config, which must be a YAML array of file paths. Each element is type-asserted to a string; if any element is not a string (e.g. a number, boolean, or nested map), the library aborts config loading with this error. It exists to fail fast on malformed alteration wordlist configuration instead of silently skipping entries.

Solutions

  1. Quote each wordlist path in the config so YAML parses it as a string: wordlist_file: ["2024.txt", "/usr/share/wordlists/common.txt"].
  2. Validate the parsed config structure with a YAML tool or by printing the loaded options to confirm wordlist_file is an array of strings.
  3. If paths are generated programmatically, convert them to strings before writing the config.

Example fix

// before (config.yaml)
alterations:
  wordlist_file:
    - 2024
// after
alterations:
  wordlist_file:
    - "2024.txt"
Defensive patterns

Strategy: validation

Validate before calling

raw, _ := os.ReadFile(cfgPath)
var doc map[string]any
_ = yaml.Unmarshal(raw, &doc)
alt, _ := doc["alterations"].(map[string]any)
wlf, _ := alt["wordlist_file"].([]any)
for i, item := range wlf {
    if _, ok := item.(string); !ok {
        return fmt.Errorf("alterations.wordlist_file[%d] must be a string, got %T", i, item)
    }
}

Type guard

func isStringList(v []any) bool {
    for _, item := range v {
        if _, ok := item.(string); !ok {
            return false
        }
    }
    return true
}

Try / catch

if err := cfg.LoadSettings(path); err != nil {
    if strings.Contains(err.Error(), "wordlist_file item is not a string") {
        // fix config or fall back to defaults
    }
    return err
}

Prevention

When it happens

Trigger: A config file where 'alterations: wordlist_file:' contains a non-string item, e.g. wordlist_file: [123], [true], or a nested list. Produced by the type assertion wordlistPathRaw.(string) failing while iterating wordlistPaths.

Common situations: Hand-edited YAML without quotes where a value looks numeric (e.g. 2024.txt becomes a number); templated config generation injecting non-string values; copy-paste mistakes nesting a list inside the list.

Related errors


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

Appendix: source

Thrown at config/brute.go:94

	if !ok {
		return fmt.Errorf("alterations enabled is not a bool")
	}

	c.Alterations = enabled
	if !c.Alterations {
		return nil
	}

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

		for _, wordlistPathRaw := range wordlistPaths {
			wordlistPath, ok := wordlistPathRaw.(string)
			if !ok {
				return fmt.Errorf("alterations 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 alterations wordlist_file setting: %s: %v", absPath, err)
			}

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

	c.AltWordlist = stringset.Deduplicate(c.AltWordlist)
	return nil

View on GitHub (pinned to 79299dce87)