{"record":{"id":"99e42cedcb8eaeb0","repo":"JuliusBrussee/caveman","slug":"gzip-read-w","errorCode":null,"errorMessage":"gzip read: %w","messagePattern":"gzip read: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/objectstore/compress.go","lineNumber":84,"sourceCode":"func DecompressLimit(codec string, data []byte, maxBytes int64) ([]byte, error) {\n\tif maxBytes < 0 || maxBytes > DefaultMaxDecompressedBytes {\n\t\treturn nil, fmt.Errorf(\"invalid decompression limit %d\", maxBytes)\n\t}\n\tswitch codec {\n\tcase CompressionNone, \"\":\n\t\tif int64(len(data)) > maxBytes {\n\t\t\treturn nil, ErrDecompressedTooLarge\n\t\t}\n\t\treturn data, nil\n\tcase CompressionGzip:\n\t\tzr, err := gzip.NewReader(bytes.NewReader(data))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"gzip reader: %w\", err)\n\t\t}\n\t\tdefer zr.Close()\n\t\tout, err := io.ReadAll(io.LimitReader(zr, maxBytes+1))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"gzip read: %w\", err)\n\t\t}\n\t\tif int64(len(out)) > maxBytes {\n\t\t\treturn nil, ErrDecompressedTooLarge\n\t\t}\n\t\treturn out, nil\n\tcase CompressionZstd:\n\t\t// Zstd's smallest legal window is 1 KiB. Keep that parser minimum for\n\t\t// tiny valid payloads, then independently enforce the exact byte limit.\n\t\tmemoryLimit := uint64(maxBytes)\n\t\tif memoryLimit < zstd.MinWindowSize {\n\t\t\tmemoryLimit = zstd.MinWindowSize\n\t\t}\n\t\tzr, err := zstd.NewReader(nil,\n\t\t\tzstd.WithDecoderConcurrency(1),\n\t\t\tzstd.WithDecoderMaxMemory(memoryLimit),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"zstd reader: %w\", err)","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/shared/platform/objectstore/compress.go#L66-L102","documentation":"Error \"gzip read: %w\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at shared/platform/objectstore/compress.go:84 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the gzip read error; the data may be truncated."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}