{"record":{"id":"9a934479d3c2723d","repo":"thanos-io/thanos","slug":"preloaded-chunk-too-small-expecting-d-and-faile","errorCode":null,"errorMessage":"preloaded chunk too small, expecting %d, and failed to fetch full chunk","messagePattern":"preloaded chunk too small, expecting (.+?), and failed to fetch full chunk","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/bucket.go","lineNumber":3817,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"populate chunk\")\n\t\t\t}\n\t\t\tstats.add(ChunksTouched, 1, int(chunkDataLen))\n\t\t\tcontinue\n\t\t}\n\n\t\tr.block.metrics.chunkRefetches.WithLabelValues(tenant).Inc()\n\t\t// If we didn't fetch enough data for the chunk, fetch more.\n\t\tfetchBegin = time.Now()\n\t\t// Read entire chunk into new buffer.\n\t\t// TODO: readChunkRange call could be avoided for any chunk but last in this particular part.\n\t\tif err := bytesLimiter.ReserveWithType(uint64(chunkLen), ChunksTouched); err != nil {\n\t\t\treturn httpgrpc.Errorf(int(codes.ResourceExhausted), \"exceeded bytes limit while fetching chunks: %s\", err)\n\t\t}\n\n\t\tnb, err := r.block.readChunkRange(ctx, seq, int64(pIdx.offset), int64(chunkLen), []byteRange{{offset: 0, length: chunkLen}}, r.logger)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"preloaded chunk too small, expecting %d, and failed to fetch full chunk\", chunkLen)\n\t\t}\n\t\tif len(*nb) != chunkLen {\n\t\t\treturn errors.Errorf(\"preloaded chunk too small, expecting %d\", chunkLen)\n\t\t}\n\n\t\tstats.add(ChunksFetched, 1, len(*nb))\n\t\tc := rawChunk((*nb)[n:])\n\t\terr = populateChunk(&(res[pIdx.seriesEntry].chks[pIdx.chunk]), &c, aggrs, r.save, calculateChunkChecksum)\n\t\tif err != nil {\n\t\t\tr.block.chunkPool.Put(nb)\n\t\t\treturn errors.Wrap(err, \"populate chunk\")\n\t\t}\n\n\t\tstats.add(ChunksTouched, 1, int(chunkDataLen))\n\n\t\tr.block.chunkPool.Put(nb)\n\t}\n\treturn nil","sourceCodeStart":3799,"sourceCodeEnd":3835,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/bucket.go#L3799-L3835","documentation":"Raised in bucketChunkReader.load when the pooled pre-fetch range was too small for the chunk (fetched chunkLen < expected length) and the subsequent refetch of the full chunk also failed to obtain complete data. The chunk remains unavailable, so series loading for that chunk fails.","triggerScenarios":"Thrown at pkg/store/bucket.go:3817 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the query; refetch failures are often transient object store errors","Check chunk sizes exceeding estimatedMaxChunkSize and object store range behavior","Verify bucket read permissions and network stability between store gateway and object storage"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}