JuliusBrussee/caveman · error
gzip reader: %w
Error message
gzip reader: %w
What it means
Error "gzip reader: %w" thrown in JuliusBrussee/caveman.
Source
Thrown at shared/platform/objectstore/compress.go:79
// DecompressLimit reverses Compress while refusing to produce more than
// maxBytes of plaintext. The limit is applied while decoding gzip and through
// zstd's decoder memory bound, so highly-compressible hostile payloads cannot
// first allocate their full expanded size and only then be rejected.
func DecompressLimit(codec string, data []byte, maxBytes int64) ([]byte, error) {
if maxBytes < 0 || maxBytes > DefaultMaxDecompressedBytes {
return nil, fmt.Errorf("invalid decompression limit %d", maxBytes)
}
switch codec {
case CompressionNone, "":
if int64(len(data)) > maxBytes {
return nil, ErrDecompressedTooLarge
}
return data, nil
case CompressionGzip:
zr, err := gzip.NewReader(bytes.NewReader(data))
if err != nil {
return nil, fmt.Errorf("gzip reader: %w", err)
}
defer zr.Close()
out, err := io.ReadAll(io.LimitReader(zr, maxBytes+1))
if err != nil {
return nil, fmt.Errorf("gzip read: %w", err)
}
if int64(len(out)) > maxBytes {
return nil, ErrDecompressedTooLarge
}
return out, nil
case CompressionZstd:
// Zstd's smallest legal window is 1 KiB. Keep that parser minimum for
// tiny valid payloads, then independently enforce the exact byte limit.
memoryLimit := uint64(maxBytes)
if memoryLimit < zstd.MinWindowSize {
memoryLimit = zstd.MinWindowSize
}
zr, err := zstd.NewReader(nil,View on GitHub (pinned to 27d5a3981a)
Solutions
- The gzip stream is invalid; provide valid gzip data.
When it happens
Trigger: Thrown at shared/platform/objectstore/compress.go:79 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/d3c68f783bc5afab.
Report an issue: GitHub.