{"record":{"id":"7b93d5fc92dbbd97","repo":"thanos-io/thanos","slug":"preload-series","errorCode":null,"errorMessage":"preload series","messagePattern":"preload series","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/bucket.go","lineNumber":1306,"sourceCode":"\t\t\t\t}\n\t\t\t\tif v >= 2 {\n\t\t\t\t\tfor i := range b.expandedPostings {\n\t\t\t\t\t\tb.expandedPostings[i] = b.expandedPostings[i] / 16\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tb.indexr.storeExpandedPostingsToCache(b.blockMatchers, index.NewListPostings(b.expandedPostings), len(b.expandedPostings), tenant)\n\t\t}\n\t\treturn nil\n\t}\n\n\tb.indexr.reset(len(postingsBatch))\n\tif !b.skipChunks {\n\t\tb.chunkr.reset()\n\t}\n\n\tif err := b.indexr.PreloadSeries(b.ctx, postingsBatch, b.bytesLimiter, b.tenant); err != nil {\n\t\treturn errors.Wrap(err, \"preload series\")\n\t}\n\n\tseriesMatched := 0\n\tb.entries = b.entries[:0]\nOUTER:\n\tfor i := range postingsBatch {\n\t\tif err := b.ctx.Err(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\thasMatchedChunks, err := b.indexr.LoadSeriesForTime(postingsBatch[i], &b.symbolizedLset, &b.chkMetas, b.skipChunks, b.mint, b.maxt)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"read series\")\n\t\t}\n\t\t// Skip getting series symbols if we know there is no matched chunks\n\t\t// and lazy expanded posting not enabled.\n\t\tif !lazyExpandedPosting && !hasMatchedChunks {\n\t\t\tcontinue\n\t\t}","sourceCodeStart":1288,"sourceCodeEnd":1324,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/bucket.go#L1288-L1324","documentation":"Wraps IndexReader.PreloadSeries failure in blockSeriesClient.series. PreloadSeries fetches the series data referenced by the expanded postings batch into the index reader's cache before per-series loading. Failures typically stem from index fetch or decode errors and are bounded by the bytes limiter.","triggerScenarios":"Series streaming calls preload with a postings batch; indexr.PreloadSeries(ctx, postingsBatch, bytesLimiter, tenant) fails on fetching series data from the block index, decoding corrupt series sections, or exhausting the request bytes limit.","commonSituations":"Corrupted block index sections, object-store timeouts under heavy query load, queries too large for the configured per-request bytes limit, blocks removed from the bucket mid-query.","solutions":["Check the wrapped root error; for byte-limit exhaustion, raise the store's per-request size limits or narrow the query time/matcher range.","Verify the block index integrity with 'thanos tools bucket verify' and remove corrupted blocks.","Retry on transient object-store failures; check bucket latency/limits.","Reduce query fan-out concurrency to avoid store resource exhaustion."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Estimate request size before issuing wide queries\nspan := maxt - mint\nif span > maxQuerySpan {\n\treturn fmt.Errorf(\"query span %d exceeds limit %d; narrow the range\", span, maxQuerySpan)\n}","typeGuard":null,"tryCatchPattern":"if err := runSeriesQuery(ctx, q); err != nil && strings.Contains(err.Error(), \"preload series\") {\n\tif isBytesLimitExceeded(err) {\n\t\treturn splitAndRetry(ctx, q) // split query into smaller time windows\n\t}\n\treturn err\n}","preventionTips":["Bound query time ranges and matcher selectivity to keep posting batches small.","Configure per-request bytes limits to match expected query sizes.","Verify block indexes periodically; corrupt series sections surface here.","Retry transient object-store failures with exponential backoff."],"tags":["index","series-loading","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"}