{"record":{"id":"98e949eac43a9d4f","repo":"thanos-io/thanos","slug":"load-chunks","errorCode":null,"errorMessage":"load chunks","messagePattern":"load chunks","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/bucket.go","lineNumber":1403,"sourceCode":"\n\t\t// Ensure sample limit through chunksLimiter if we return chunks.\n\t\tif err := b.chunksLimiter.Reserve(uint64(len(b.chkMetas))); err != nil {\n\t\t\treturn httpgrpc.Errorf(int(codes.ResourceExhausted), \"exceeded chunks limit: %s\", err)\n\t\t}\n\n\t\tb.entries = append(b.entries, s)\n\t}\n\n\tif lazyExpandedPosting {\n\t\t// Apply series limit before fetching chunks, for actual series matched.\n\t\tif err := b.seriesLimiter.Reserve(uint64(seriesMatched)); err != nil {\n\t\t\treturn httpgrpc.Errorf(int(codes.ResourceExhausted), \"exceeded series limit: %s\", err)\n\t\t}\n\t}\n\n\tif !b.skipChunks {\n\t\tif err := b.chunkr.load(b.ctx, b.entries, b.loadAggregates, b.calculateChunkHash, b.bytesLimiter, b.tenant); err != nil {\n\t\t\treturn errors.Wrap(err, \"load chunks\")\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc populateChunk(out *storepb.AggrChunk, in chunkenc.Chunk, aggrs []storepb.Aggr, save func([]byte) ([]byte, error), calculateChecksum bool) error {\n\thasher := hashPool.Get().(hash.Hash64)\n\tdefer hashPool.Put(hasher)\n\n\tif in.Encoding() == chunkenc.EncXOR || in.Encoding() == chunkenc.EncHistogram || in.Encoding() == chunkenc.EncFloatHistogram {\n\t\tb, err := save(in.Bytes())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tout.Raw = &storepb.Chunk{\n\t\t\tData: b,\n\t\t\tType: chunkToStoreEncoding(in.Encoding()),","sourceCodeStart":1385,"sourceCodeEnd":1421,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/bucket.go#L1385-L1421","documentation":"Wraps chunkr.load failure in blockSeriesClient.series. load executes all scheduled chunk fetches, fetching chunk data from the object store via the block's chunk reader and applying bytes limits. This is the final and most data-heavy step of series serving, so failures usually reflect storage access or size-limit problems.","triggerScenarios":"skipChunks is false and b.chunkr.load(ctx, entries, loadAggregates, calculateChunkHash, bytesLimiter, tenant) errors: chunk fetch from object storage failed, chunk data is corrupt/decode failed, or the bytes limiter rejected the request size.","commonSituations":"Object-store throttling or timeouts on wide queries, corrupted chunk files in the bucket, queries exceeding configured per-request bytes limits, blocks deleted mid-query.","solutions":["Read the wrapped root error: for byte-limit issues, lower query time range or increase store request-size limits.","Verify chunk integrity with 'thanos tools bucket verify'; remove corrupted blocks and let them be re-uploaded.","Check object-store error rates/limits (throttling, timeouts) and retry transient failures.","Ensure query concurrency and chunk-pool settings match the store gateway's resources."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Preflight: ensure query fits within bytes limit\nestimated := len(matchers) * avgSeriesPerMatcher * avgChunksPerSeries * avgChunkSize\nif estimated > maxRequestBytes {\n\treturn fmt.Errorf(\"estimated payload %d exceeds limit %d\", estimated, maxRequestBytes)\n}","typeGuard":null,"tryCatchPattern":"err := store.Series(ctx, hints, mint, maxt, matchers)\nfor attempt := 0; err != nil && strings.Contains(err.Error(), \"load chunks\") && attempt < 3; attempt++ {\n\tif !isTransient(err) {\n\t\tbreak\n\t}\n\ttime.Sleep(backoffFor(attempt))\n\terr = store.Series(ctx, hints, mint, maxt, matchers)\n}","preventionTips":["Use query sharding/time splitting to keep per-request chunk volume small.","Configure store request bytes limits and check them against real query profiles.","Monitor and tune object-store rate limits; chunk loads dominate egress.","Run bucket verification to catch corrupted chunk files before queries hit them."],"tags":["chunks","object-storage","thanos-store"],"backgroundTag":"database-query-failed","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"}