JuliusBrussee/caveman · error

gzip read: %w

Error message

gzip read: %w

What it means

Error "gzip read: %w" thrown in JuliusBrussee/caveman.

Source

Thrown at shared/platform/objectstore/compress.go:84

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,
			zstd.WithDecoderConcurrency(1),
			zstd.WithDecoderMaxMemory(memoryLimit),
		)
		if err != nil {
			return nil, fmt.Errorf("zstd reader: %w", err)

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Fix the gzip read error; the data may be truncated.

When it happens

Trigger: Thrown at shared/platform/objectstore/compress.go:84 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/99e42cedcb8eaeb0. Report an issue: GitHub.