owasp-amass/amass · error
error rewinding the file %s: %s
Error message
error rewinding the file %s: %s
What it means
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).
Source
Thrown at config/wordlist.go:128
finfo, err := file.Stat()
if err != nil {
return nil, err
}
if finfo.Size() < 512 {
return nil, errors.New("file cannot be checked for compression")
}
// We need to determine if this is a gzipped file or a plain text file, so we
// first read the first 512 bytes to pass them down to http.DetectContentType
// for mime detection. The file is rewinded before passing it along to the
// next reader
head := make([]byte, 512)
if _, err = file.Read(head); err != nil {
return nil, fmt.Errorf("error reading the first 512 bytes from %s: %s", absPath, err)
}
if _, err = file.Seek(0, 0); err != nil {
return nil, fmt.Errorf("error rewinding the file %s: %s", absPath, err)
}
// Read the file as gzip if it's actually compressed
if mt := http.DetectContentType(head); mt == "application/gzip" || mt == "application/x-gzip" {
gzReader, err := gzip.NewReader(file)
if err != nil {
return nil, fmt.Errorf("error gz-reading the file %s: %v", absPath, err)
}
return gzReader, nil
}
return nil, fmt.Errorf("%s is not compressed", absPath)
}
func GetWordList(reader io.Reader) ([]string, error) {
var words []string
View on GitHub (pinned to 79299dce87)
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
Example fix
// before
GetListFromFile("/dev/stdin")
// after
tmp, _ := os.CreateTemp("", "wl"); io.Copy(tmp, os.Stdin); tmp.Close()
GetListFromFile(tmp.Name()) Defensive patterns
Strategy: validation
Validate before calling
info, err := os.Stat(path)
if err == nil && !info.Mode().IsRegular() { return errors.New("wordlist must be a seekable regular file") } Try / catch
words, err := GetListFromFile(p)
if err != nil {
if strings.HasPrefix(err.Error(), "error rewinding the file") {
// copy input to a temp file and retry with the temp path
}
return err
} Prevention
- 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
When it happens
Trigger: file.Seek(0, 0) errors inside getGzipReader because the opened path is a FIFO, socket, or device file rather than a regular file.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- error opening the file %s: %v
- error reading the first 512 bytes from %s: %s
- the file is empty
- failed to get absolute path for wordlist file: %w
- unable to load the file in the bruteforce wordlist_file sett
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/e704424d5f3630e6.
Report an issue: GitHub.