{"record":{"id":"d7b83b76705ac4d5","repo":"thanos-io/thanos","slug":"read-range-for-seq-d-offset-x","errorCode":null,"errorMessage":"read range for seq %d offset %x","messagePattern":"read range for seq (.+?) offset %x","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/bucket.go","lineNumber":3785,"sourceCode":"\t\t\t\treturn errors.Wrap(err, \"fast forward range reader\")\n\t\t\t}\n\t\t\treadOffset += written\n\t\t}\n\t\t// Presume chunk length to be reasonably large for common use cases.\n\t\t// However, declaration for EstimatedMaxChunkSize warns us some chunks could be larger in some rare cases.\n\t\t// This is handled further down below.\n\t\tchunkLen = r.block.estimatedMaxChunkSize\n\t\tif i+1 < len(pIdxs) {\n\t\t\tif diff = pIdxs[i+1].offset - pIdx.offset; int(diff) < chunkLen {\n\t\t\t\tchunkLen = int(diff)\n\t\t\t}\n\t\t}\n\t\tcb := buf[:chunkLen]\n\t\tn, err = io.ReadFull(bufReader, cb)\n\t\treadOffset += n\n\t\t// Unexpected EOF for last chunk could be a valid case. Any other errors are definitely real.\n\t\tif err != nil && !errors.Is(err, io.ErrUnexpectedEOF) && i != len(pIdxs)-1 {\n\t\t\treturn errors.Wrapf(err, \"read range for seq %d offset %x\", seq, pIdx.offset)\n\t\t}\n\n\t\tchunkDataLen, n := binary.Uvarint(cb)\n\t\tif n < 1 {\n\t\t\treturn errors.New(\"reading chunk length failed\")\n\t\t}\n\n\t\t// Chunk length is n (number of bytes used to encode chunk data), 1 for chunk encoding and chunkDataLen for actual chunk data.\n\t\t// There is also crc32 after the chunk, but we ignore that.\n\t\tchunkLen = n + 1 + int(chunkDataLen)\n\t\tif chunkLen <= len(cb) {\n\t\t\tc := rawChunk(cb[n:chunkLen])\n\t\t\terr = populateChunk(&(res[pIdx.seriesEntry].chks[pIdx.chunk]), &c, aggrs, r.save, calculateChunkChecksum)\n\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","sourceCodeStart":3767,"sourceCodeEnd":3803,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/bucket.go#L3767-L3803","documentation":"Raised in bucketChunkReader.load when io.ReadFull fails to read the pre-computed byte range for chunk (seq, offset) from the object storage stream. Any error other than an expected ErrUnexpectedEOF on the last chunk is fatal — the fetched range is incomplete or the storage stream broke.","triggerScenarios":"Thrown at pkg/store/bucket.go:3785 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the query to rule out transient object store errors","Verify range GET support and integrity of the chunks/index files in the bucket","Increase the fetch window if chunks routinely exceed estimatedMaxChunkSize"],"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"}