{"record":{"id":"7db3551fee46060e","repo":"owasp-amass/amass","slug":"s-is-not-compressed","errorCode":null,"errorMessage":"%s is not compressed","messagePattern":"(.+?) is not compressed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"config/wordlist.go","lineNumber":141,"sourceCode":"\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\n\tscanner := bufio.NewScanner(reader)\n\tfor scanner.Scan() {\n\t\t// Get the next word in the list\n\t\tw := strings.TrimSpace(scanner.Text())\n\t\tif err := scanner.Err(); err == nil && w != \"\" {\n\t\t\twords = append(words, w)\n\t\t}\n\t}\n\n\treturn stringset.Deduplicate(words), nil\n}\n","sourceCodeStart":123,"sourceCodeEnd":158,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/wordlist.go#L123-L158","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before: assuming .gz means compressed\nwords, err := config.GetListFromFile(\"wordlist.txt.gz\")\n\n// after: check the actual content type first\nhead := make([]byte, 512)\nf, _ := os.Open(\"wordlist.txt.gz\")\nn, _ := f.Read(head)\nf.Close()\nif http.DetectContentType(head[:n]) != \"application/gzip\" {\n    return fmt.Errorf(\"wordlist.txt.gz is not actually gzip-compressed\")\n}\nwords, err := config.GetListFromFile(\"wordlist.txt.gz\")","handlingStrategy":"validation","validationCode":"func checkWordlistCompression(path string) (compressed bool, err error) {\n    f, err := os.Open(path)\n    if err != nil { return false, err }\n    defer f.Close()\n    fi, err := f.Stat()\n    if err != nil { return false, err }\n    if fi.Size() < 512 { return false, fmt.Errorf(\"file too small to sniff\") }\n    head := make([]byte, 512)\n    if _, err := io.ReadFull(f, head); err != nil { return false, err }\n    mt := http.DetectContentType(head)\n    return mt == \"application/gzip\" || mt == \"application/x-gzip\", nil\n}","typeGuard":"func hasGzipMagic(path string) bool {\n    f, err := os.Open(path)\n    if err != nil { return false }\n    defer f.Close()\n    b := make([]byte, 2)\n    n, err := f.Read(b)\n    return err == nil && n == 2 && b[0] == 0x1f && b[1] == 0x8b\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["gzip","content-detection","wordlist","go"],"backgroundTag":"incompatible-source-type","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"}