{"record":{"id":"819bc574d5edb62c","repo":"owasp-amass/amass","slug":"the-file-is-empty","errorCode":null,"errorMessage":"the file is empty","messagePattern":"the file is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/wordlist.go","lineNumber":98,"sourceCode":"\n// GetListFromFile reads a wordlist text or gzip file and returns the slice of words.\nfunc GetListFromFile(path string) ([]string, error) {\n\tvar reader io.Reader\n\n\tabsPath, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get absolute path: %v\", err)\n\t}\n\n\tfile, err := os.Open(absPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error opening the file %s: %v\", absPath, err)\n\t}\n\tdefer func() { _ = file.Close() }()\n\treader = file\n\n\tif finfo, err := file.Stat(); err == nil && finfo.Size() == 0 {\n\t\treturn nil, errors.New(\"the file is empty\")\n\t}\n\n\tif gz, err := getGzipReader(file, absPath); err == nil {\n\t\tdefer func() { _ = gz.Close() }()\n\t\treader = gz\n\t}\n\n\treturn GetWordList(reader)\n}\n\nfunc getGzipReader(file *os.File, absPath string) (*gzip.Reader, error) {\n\tfinfo, err := file.Stat()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif finfo.Size() < 512 {\n\t\treturn nil, errors.New(\"file cannot be checked for compression\")","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/wordlist.go#L80-L116","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Populate the wordlist file with one entry per line.","Point the config/flag at a non-empty wordlist file.","Check file size (ls -l / os.Stat) before running.","Re-download the wordlist if it was truncated."],"exampleFix":"# before\nwordlist = /path/to/empty.txt   # 0 bytes\n# after\nwordlist = /usr/share/wordlists/subdomains.txt","handlingStrategy":"validation","validationCode":"info, err := os.Stat(path)\nif err != nil { return err }\nif info.Size() == 0 { return fmt.Errorf(\"wordlist %s is empty\", path) }","typeGuard":null,"tryCatchPattern":"list, err := GetListFromFile(path)\nif err != nil {\n    if strings.Contains(err.Error(), \"the file is empty\") {\n        // fall back to a default wordlist or abort with a clear message\n    }\n    return err\n}","preventionTips":["Check file size before passing wordlist paths.","Verify downloads completed (checksum/size).","Avoid committing empty placeholder wordlist files.","Use well-known wordlists from package resources."],"tags":["file","wordlist","empty"],"backgroundTag":"file-read-failed","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"}