grafana/k6 · error
unknown compressionType %s
Error message
unknown compressionType %s
What it means
Raised by compressBody when a requested compression algorithm falls through the switch on CompressionType without matching gzip, deflate, zstd or brotli. In practice this indicates an unparseable or unsupported value in the setCompression / compression option.
Source
Thrown at lib/netext/httpext/compression.go:64
}
buf = new(bytes.Buffer)
if contentEncoding != "" {
contentEncoding += ", "
}
contentEncoding += compressionType.String()
var w io.WriteCloser
switch compressionType {
case CompressionTypeGzip:
w = gzip.NewWriter(buf)
case CompressionTypeDeflate:
w = zlib.NewWriter(buf)
case CompressionTypeZstd:
w, _ = zstd.NewWriter(buf)
case CompressionTypeBr:
w = brotli.NewWriter(buf)
default:
return nil, "", fmt.Errorf("unknown compressionType %s", compressionType)
}
// we don't close in defer because zlib will write it's checksum again if it closes twice :(
_, err := io.Copy(w, prevBuf)
if err != nil {
_ = w.Close()
return nil, "", err
}
if err = w.Close(); err != nil {
return nil, "", err
}
}
return buf, contentEncoding, body.Close()
}
//nolint:gochecknoglobals
var decompressionErrors = [...]error{View on GitHub (pinned to 01ffac6f24)
Solutions
- Use only supported compression keywords: gzip, deflate, zstd, brotli (or their Content-Encoding names)
- Check the spelling of values passed to setCompression or the compression option
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/netext/httpext/compression.go:64 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/227ca2e16b918e3f.
Report an issue: GitHub.