{"record":{"id":"0aae8787c3617e89","repo":"thanos-io/thanos","slug":"reference-sequence-d-out-of-range","errorCode":null,"errorMessage":"reference sequence %d out of range","messagePattern":"reference sequence (.+?) out of range","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/bucket.go","lineNumber":3669,"sourceCode":"\t\t<-r.finishLoadingChks\n\t}\n\tr.block.pendingReaders.Done()\n\n\tfor _, b := range r.chunkBytes {\n\t\tr.block.chunkPool.Put(b)\n\t}\n\treturn nil\n}\n\n// addLoad adds the chunk with id to the data set to be fetched.\n// Chunk will be fetched and saved to refs[seriesEntry][chunk] upon r.load(refs, <...>) call.\nfunc (r *bucketChunkReader) addLoad(id chunks.ChunkRef, seriesEntry, chunk int) error {\n\tvar (\n\t\tseq = int(id >> 32)\n\t\toff = uint32(id)\n\t)\n\tif seq >= len(r.toLoad) {\n\t\treturn errors.Errorf(\"reference sequence %d out of range\", seq)\n\t}\n\tr.toLoad[seq] = append(r.toLoad[seq], loadIdx{off, seriesEntry, chunk})\n\treturn nil\n}\n\n// load loads all added chunks and saves resulting aggrs to refs.\nfunc (r *bucketChunkReader) load(ctx context.Context, res []seriesEntry, aggrs []storepb.Aggr, calculateChunkChecksum bool, bytesLimiter BytesLimiter, tenant string) error {\n\tr.loadingChunksMtx.Lock()\n\tr.loadingChunks = true\n\tr.loadingChunksMtx.Unlock()\n\n\tbegin := time.Now()\n\tdefer func() {\n\t\tr.stats.ChunksDownloadLatencySum += time.Since(begin)\n\n\t\tr.loadingChunksMtx.Lock()\n\t\tr.loadingChunks = false\n\t\tr.loadingChunksMtx.Unlock()","sourceCodeStart":3651,"sourceCodeEnd":3687,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/bucket.go#L3651-L3687","documentation":"Raised in bucketChunkReader.addLoad when a chunk reference's high 32-bit sequence number (seq = id >> 32) is greater than or equal to the number of partitioned chunkseq loaders (r.toLoad). The chunk ref points to a part of the index that this reader did not initialize — a stale/invalid chunk reference or an index/partition mismatch.","triggerScenarios":"Thrown at pkg/store/bucket.go:3669 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the block index is consistent with the chunk refs being queried","Ensure the block was not deleted/replaced mid-query (re-fetch block meta)","Check for corrupted index partitions in the object store"],"exampleFix":null,"handlingStrategy":"validation","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"}