owasp-amass/amass · warning
%s is not compressed
Error message
%s is not compressed
What it means
This error is returned by getGzipReader when http.DetectContentType on the first 512 bytes does not identify the file as application/gzip or application/x-gzip, meaning the file is treated as a plain (uncompressed) file. It is a detection signal rather than a hard failure: GetListFromFile ignores it (line 101: `if gz, err := getGzipReader(...); err == nil`) and simply reads the file as plain text. Note also that files smaller than 512 bytes can never pass the sniff and always yield this error path.
Source
Thrown at config/wordlist.go:141
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
scanner := bufio.NewScanner(reader)
for scanner.Scan() {
// Get the next word in the list
w := strings.TrimSpace(scanner.Text())
if err := scanner.Err(); err == nil && w != "" {
words = append(words, w)
}
}
return stringset.Deduplicate(words), nil
}
View on GitHub (pinned to 79299dce87)
Solutions
- Confirm the file's actual type with `file <path>`; if it is plain text, use it as-is — this error is informational and GetListFromFile will read it correctly.
- If the file should be gzip, verify it starts with the gzip magic bytes (1f 8b) and is a valid archive: `gzip -t <file>`; re-create it if not.
- For gzip files smaller than 512 bytes, pad the wordlist or use a larger file, since the sniffing code skips gzip handling for files under 512 bytes.
- Do not rely on the error to detect 'not compressed' at the GetListFromFile call site — the error is swallowed there; check the file type beforehand if your pipeline requires compression.
- If you need guaranteed gzip handling, decompress the file yourself (os/exec gzip -d or compress/gzip directly) and pass the uncompressed reader/path.
Example fix
// before: assuming .gz means compressed
words, err := config.GetListFromFile("wordlist.txt.gz")
// after: check the actual content type first
head := make([]byte, 512)
f, _ := os.Open("wordlist.txt.gz")
n, _ := f.Read(head)
f.Close()
if http.DetectContentType(head[:n]) != "application/gzip" {
return fmt.Errorf("wordlist.txt.gz is not actually gzip-compressed")
}
words, err := config.GetListFromFile("wordlist.txt.gz") Defensive patterns
Strategy: validation
Validate before calling
func checkWordlistCompression(path string) (compressed bool, err error) {
f, err := os.Open(path)
if err != nil { return false, err }
defer f.Close()
fi, err := f.Stat()
if err != nil { return false, err }
if fi.Size() < 512 { return false, fmt.Errorf("file too small to sniff") }
head := make([]byte, 512)
if _, err := io.ReadFull(f, head); err != nil { return false, err }
mt := http.DetectContentType(head)
return mt == "application/gzip" || mt == "application/x-gzip", nil
} Type guard
func hasGzipMagic(path string) bool {
f, err := os.Open(path)
if err != nil { return false }
defer f.Close()
b := make([]byte, 2)
n, err := f.Read(b)
return err == nil && n == 2 && b[0] == 0x1f && b[1] == 0x8b
} Prevention
- Run `file <wordlist>` before loading so the extension matches the actual content type.
- Remember files under 512 bytes can never be detected as gzip by this code path — use larger wordlists or decompress manually.
- Treat this error as informational when feeding plain-text lists; only act on it if you expected compression.
- Never rename a decompressed file back to .gz; keep extension and content in sync.
- If compression is mandatory in your pipeline, decompress yourself and verify the plaintext before passing it in.
When it happens
Trigger: Calling config.GetListFromFile on a plain .txt wordlist (intentional path); calling it on a .gz-named file whose content is not gzip (misnamed file, plain text renamed to .gz, or a gzip file smaller than 512 bytes so the sniff is skipped via the 'file cannot be checked for compression' branch, which also returns an error and thus falls back to plain-text reading).
Common situations: Users passing a text wordlist with a .gz extension after decompressing in place; empty or tiny gzip files under 512 bytes that cannot be content-sniffed; symlinked or loopback/mounted files where Read/Seek behave unexpectedly; confusion when the wordlist silently loads as plaintext garbage because a corrupt gz file fell back to plain reading.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- error gz-reading the file %s: %v
- failed to get absolute path for wordlist file: %w
- unable to load the file in the bruteforce wordlist_file sett
- error reading the first 512 bytes from %s: %s
- the file is empty
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/7db3551fee46060e.
Report an issue: GitHub.