{"record":{"id":"e704424d5f3630e6","repo":"owasp-amass/amass","slug":"error-rewinding-the-file-s-s","errorCode":null,"errorMessage":"error rewinding the file %s: %s","messagePattern":"error rewinding the file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/wordlist.go","lineNumber":128,"sourceCode":"\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\")\n\t}\n\n\t// We need to determine if this is a gzipped file or a plain text file, so we\n\t// first read the first 512 bytes to pass them down to http.DetectContentType\n\t// for mime detection. The file is rewinded before passing it along to the\n\t// next reader\n\thead := make([]byte, 512)\n\tif _, err = file.Read(head); err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading the first 512 bytes from %s: %s\", absPath, err)\n\t}\n\tif _, err = file.Seek(0, 0); err != nil {\n\t\treturn nil, fmt.Errorf(\"error rewinding the file %s: %s\", absPath, err)\n\t}\n\n\t// Read the file as gzip if it's actually compressed\n\tif mt := http.DetectContentType(head); mt == \"application/gzip\" || mt == \"application/x-gzip\" {\n\t\tgzReader, err := gzip.NewReader(file)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error gz-reading the file %s: %v\", absPath, err)\n\t\t}\n\n\t\treturn gzReader, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"%s is not compressed\", absPath)\n}\n\nfunc GetWordList(reader io.Reader) ([]string, error) {\n\tvar words []string\n","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/wordlist.go#L110-L146","documentation":"After sniffing the first 512 bytes, getGzipReader rewinds the file with file.Seek(0, 0) so downstream readers see the whole file; this error wraps a failed Seek. Seek failure on a regular file is rare and typically means the path refers to something non-seekable (pipe, device, socket).","triggerScenarios":"file.Seek(0, 0) errors inside getGzipReader because the opened path is a FIFO, socket, or device file rather than a regular file.","commonSituations":"Pointing the wordlist setting at /dev/stdin, a named pipe, or a process substitution instead of a real file; network mounts with broken seek support.","solutions":["Use a regular on-disk file for the wordlist, not a pipe or device","Materialize streamed input to a temp file first","Check filesystem support if using FUSE/network mounts"],"exampleFix":"// before\nGetListFromFile(\"/dev/stdin\")\n// after\ntmp, _ := os.CreateTemp(\"\", \"wl\"); io.Copy(tmp, os.Stdin); tmp.Close()\nGetListFromFile(tmp.Name())","handlingStrategy":"validation","validationCode":"info, err := os.Stat(path)\nif err == nil && !info.Mode().IsRegular() { return errors.New(\"wordlist must be a seekable regular file\") }","typeGuard":null,"tryCatchPattern":"words, err := GetListFromFile(p)\nif err != nil {\n  if strings.HasPrefix(err.Error(), \"error rewinding the file\") {\n    // copy input to a temp file and retry with the temp path\n  }\n  return err\n}","preventionTips":["Never use /dev/stdin, pipes, or process substitution as wordlist paths","Materialize streamed input to a temp file before loading","Prefer local filesystems over FUSE/network mounts for wordlists"],"tags":["wordlist","seek","io"],"backgroundTag":"unsupported-operation","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"}