{"record":{"id":"a6fe62010086ea14","repo":"thanos-io/thanos","slug":"add-chunk-load","errorCode":null,"errorMessage":"add chunk load","messagePattern":"add chunk load","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/bucket.go","lineNumber":1377,"sourceCode":"\t\tseriesMatched++\n\t\tif b.seriesLimit > 0 && seriesMatched > b.seriesLimit {\n\t\t\t// Exit early if seriesLimit is set.\n\t\t\tb.hasMorePostings = false\n\t\t\tbreak\n\t\t}\n\t\ts := seriesEntry{lset: completeLabelset}\n\t\tif b.skipChunks {\n\t\t\tb.entries = append(b.entries, s)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Schedule loading chunks.\n\t\ts.refs = make([]chunks.ChunkRef, 0, len(b.chkMetas))\n\t\ts.chks = make([]storepb.AggrChunk, 0, len(b.chkMetas))\n\n\t\tfor j, meta := range b.chkMetas {\n\t\t\tif err := b.chunkr.addLoad(meta.Ref, len(b.entries), j); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"add chunk load\")\n\t\t\t}\n\t\t\ts.chks = append(s.chks, storepb.AggrChunk{\n\t\t\t\tMinTime: meta.MinTime,\n\t\t\t\tMaxTime: meta.MaxTime,\n\t\t\t})\n\t\t\ts.refs = append(s.refs, meta.Ref)\n\t\t}\n\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.","sourceCodeStart":1359,"sourceCodeEnd":1395,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/bucket.go#L1359-L1395","documentation":"Wraps chunkr.addLoad failure while scheduling chunk fetches for a series in blockSeriesClient.series. addLoad registers a chunk reference for batched loading and fails when the same chunk reference is added twice in one batch or the request exceeds configured limits.","triggerScenarios":"For each chunk meta of a matched series, b.chunkr.addLoad(meta.Ref, len(b.entries), j) errors: duplicate chunk ref within the same series batch, or maxSeriesCount/maxChunkCount style request accounting violations.","commonSituations":"Overlapping blocks in the bucket causing duplicate chunk references for the same series, corrupted chunk metadata (duplicate Refs) in the index, misconfigured per-request limits.","solutions":["Check the bucket for overlapping/duplicate blocks via 'thanos tools bucket verify' and remove the offending block.","Inspect the wrapped root error; duplicate-ref errors usually indicate index metadata corruption.","Raise or review store request limits if limit-related, and narrow query scope.","Restart the affected store gateway to clear stale batch state after fixing the bucket."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Detect overlapping blocks in a time-range query before fan-out\nfor i := 1; i < len(blocks); i++ {\n\tif blocks[i].MinTime < blocks[i-1].MaxTime && sameSource(blocks[i], blocks[i-1]) {\n\t\tlog.Warn(\"overlapping blocks from same source; possible duplicate upload\")\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := query(ctx); err != nil && strings.Contains(err.Error(), \"add chunk load\") {\n\t// duplicate chunk ref usually means overlapping/duplicate blocks\n\tlogger.Error(\"duplicate chunk reference; run bucket verify\", \"err\", err)\n\treturn err\n}","preventionTips":["Ensure a single compactor owns the bucket to prevent duplicate/overlapping blocks.","Schedule 'thanos tools bucket verify' to catch duplicate block uploads.","Keep index metadata healthy; duplicate refs point to corrupt series metadata."],"tags":["chunks","series-loading","thanos-store"],"backgroundTag":"internal-invariant-violation","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"}