{"record":{"id":"42a05c1bfaf3b8b7","repo":"owasp-amass/amass","slug":"alterations-wordlist-file-item-is-not-a-string","errorCode":null,"errorMessage":"alterations wordlist_file item is not a string","messagePattern":"alterations wordlist_file item is not a string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/brute.go","lineNumber":94,"sourceCode":"\tif !ok {\n\t\treturn fmt.Errorf(\"alterations enabled is not a bool\")\n\t}\n\n\tc.Alterations = enabled\n\tif !c.Alterations {\n\t\treturn nil\n\t}\n\n\tif wordlistPathRaw, ok := alterations[\"wordlists\"]; ok {\n\t\twordlistPaths, ok := wordlistPathRaw.([]interface{})\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"alterations wordlist_file is not an array\")\n\t\t}\n\n\t\tfor _, wordlistPathRaw := range wordlistPaths {\n\t\t\twordlistPath, ok := wordlistPathRaw.(string)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"alterations wordlist_file item is not a string\")\n\t\t\t}\n\n\t\t\tabsPath, err := c.AbsPathFromConfigDir(wordlistPath)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to get absolute path for wordlist file: %w\", err)\n\t\t\t}\n\n\t\t\twordlist, err := GetListFromFile(absPath)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to load the file in the alterations wordlist_file setting: %s: %v\", absPath, err)\n\t\t\t}\n\n\t\t\tc.AltWordlist = append(c.AltWordlist, wordlist...)\n\t\t}\n\t}\n\n\tc.AltWordlist = stringset.Deduplicate(c.AltWordlist)\n\treturn nil","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/brute.go#L76-L112","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Quote each wordlist path in the config so YAML parses it as a string: wordlist_file: [\"2024.txt\", \"/usr/share/wordlists/common.txt\"].","Validate the parsed config structure with a YAML tool or by printing the loaded options to confirm wordlist_file is an array of strings.","If paths are generated programmatically, convert them to strings before writing the config."],"exampleFix":"// before (config.yaml)\nalterations:\n  wordlist_file:\n    - 2024\n// after\nalterations:\n  wordlist_file:\n    - \"2024.txt\"","handlingStrategy":"validation","validationCode":"raw, _ := os.ReadFile(cfgPath)\nvar doc map[string]any\n_ = yaml.Unmarshal(raw, &doc)\nalt, _ := doc[\"alterations\"].(map[string]any)\nwlf, _ := alt[\"wordlist_file\"].([]any)\nfor i, item := range wlf {\n    if _, ok := item.(string); !ok {\n        return fmt.Errorf(\"alterations.wordlist_file[%d] must be a string, got %T\", i, item)\n    }\n}","typeGuard":"func isStringList(v []any) bool {\n    for _, item := range v {\n        if _, ok := item.(string); !ok {\n            return false\n        }\n    }\n    return true\n}","tryCatchPattern":"if err := cfg.LoadSettings(path); err != nil {\n    if strings.Contains(err.Error(), \"wordlist_file item is not a string\") {\n        // fix config or fall back to defaults\n    }\n    return err\n}","preventionTips":["Quote every wordlist path in YAML configs","Lint configs with yamllint before deployment","Add a CI step that parses and validates config structure","Avoid generating wordlist values programmatically without string conversion"],"tags":["config","yaml","type-mismatch","validation"],"backgroundTag":"config-type-mismatch","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}