{"record":{"id":"b9b341c5eb4b100a","repo":"owasp-amass/amass","slug":"error-opening-the-file-s-v","errorCode":null,"errorMessage":"error opening the file %s: %v","messagePattern":"error opening the file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/wordlist.go","lineNumber":92,"sourceCode":"\t\t\tnewWordlist = append(newWordlist, words...)\n\t\t}\n\t}\n\n\treturn newWordlist, nil\n}\n\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()","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/wordlist.go#L74-L110","documentation":"After resolving the absolute path, GetListFromFile opens the wordlist file; if os.Open fails (missing file, no permission, it's a directory), this error wraps the OS error together with the path. It is the standard 'couldn't open wordlist' failure.","triggerScenarios":"os.Open returns an error: the file doesn't exist at absPath, permission is denied, the path points to a directory, or the path is empty/garbage.","commonSituations":"Typo in the wordlist path in brute-force or alteration settings; wordlist not mounted in a container; file present but unreadable by the running user.","solutions":["Verify the file exists at the exact path (ls the path)","Fix the path in your brute-force/alteration config or CLI flag","Check read permissions on the file and traverse permissions on parent dirs","Ensure the path is a file, not a directory"],"exampleFix":"// before\nGetListFromFile(\"/usr/share/wordlists/commn.txt\")\n// after\nGetListFromFile(\"/usr/share/wordlists/common.txt\")","handlingStrategy":"validation","validationCode":"info, err := os.Stat(path)\nif err != nil { return err }\nif info.IsDir() { return errors.New(\"wordlist path is a directory\") }\nif info.Mode()&0o400 == 0 { return errors.New(\"wordlist not readable\") }","typeGuard":null,"tryCatchPattern":"words, err := GetListFromFile(p)\nif err != nil {\n  if strings.Contains(err.Error(), \"error opening the file\") {\n    // surface the path and check existence/permissions\n  }\n  return err\n}","preventionTips":["Verify wordlist paths in config at startup with os.Stat","Mount wordlists into containers at known absolute paths","Run with a user that has read access to the wordlist files"],"tags":["wordlist","file","io"],"backgroundTag":"file-open-failed","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}