{"record":{"id":"181ac0a93c4a776c","repo":"thanos-io/thanos","slug":"shipping-compacted-block-s-is-blocked-overlap-sp","errorCode":null,"errorMessage":"shipping compacted block %s is blocked; overlap spotted: %s","messagePattern":"shipping compacted block (.+?) is blocked; overlap spotted: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/shipper/shipper.go","lineNumber":301,"sourceCode":"\treturn nil\n}\n\nfunc (c *lazyOverlapChecker) IsOverlapping(ctx context.Context, newMeta tsdb.BlockMeta) error {\n\tif !c.synced {\n\t\tlevel.Info(c.logger).Log(\"msg\", \"gathering all existing blocks from the remote bucket for check\", \"id\", newMeta.ULID.String())\n\t\tif err := c.sync(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// TODO(bwplotka) so confusing! we need to sort it first. Add comment to TSDB code.\n\tmetas := append([]tsdb.BlockMeta{newMeta}, c.metas...)\n\tsort.Slice(metas, func(i, j int) bool {\n\t\treturn metas[i].MinTime < metas[j].MinTime\n\t})\n\tif o := tsdb.OverlappingBlocks(metas); len(o) > 0 {\n\t\t// TODO(bwplotka): Consider checking if overlaps relates to block in concern?\n\t\treturn errors.Errorf(\"shipping compacted block %s is blocked; overlap spotted: %s\", newMeta.ULID, o.String())\n\t}\n\treturn nil\n}\n\nfunc (s *Shipper) AreAllBlocksUploaded() (bool, error) {\n\ts.mtx.RLock()\n\tdefer s.mtx.RUnlock()\n\n\tmetas, _, err := s.blockMetasFromOldest()\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"get block metas from oldest\")\n\t}\n\n\tif len(metas) == 0 {\n\t\treturn true, nil\n\t}\n\n\tmeta, err := ReadMetaFile(s.metadataFilePath)","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/shipper/shipper.go#L283-L319","documentation":"Returned by IsOverlapping when tsdb.OverlappingBlocks detects that the newly compacted block's time range overlaps blocks already known to the shipper. Thanos refuses to upload compacted blocks that overlap existing ones to preserve the global block universe invariant (non-overlapping blocks per resolution).","triggerScenarios":"Sync with uploadCompacted enabled calls checker.IsOverlapping for a block with Compaction.Level > 1, and the new block's MinTime/MaxTime range overlaps any existing local block meta.","commonSituations":"Running Prometheus with overlapping retention or a restored/backfilled block that duplicates existing data; out-of-order compaction after a sidecar crash; re-creating blocks from snapshots while old blocks still exist; using --shipper.allow-out-of-order-uploads=false with backfilled data.","solutions":["Identify the overlapping block ULIDs from the Overlap message and delete the redundant duplicate block (locally and/or from the bucket).","Enable --shipper.allow-out-of-order-uploads on the sidecar if your setup intentionally allows overlapping uploads.","Re-compact locally so the overlapping blocks merge into a single non-overlapping block, then re-sync.","Check for duplicated data directories (e.g. two sidecars pointing at the same TSDB or a stale snapshot) and remove the stale one."],"exampleFix":"// before\n// sidecar: shipping compacted block 01ARZ... is blocked; overlap spotted: [01ARZ... and 01BXY...: 1600000-1610000 vs 1605000-1615000]\n// after\n// thanos sidecar --shipper.allow-out-of-order-uploads   # or delete the duplicate block\n// via: thanos tools bucket rm --objstore.config-file=bucket.yaml --id=01BXY...","handlingStrategy":"validation","validationCode":"metas := append([]tsdb.BlockMeta{newMeta}, existingMetas...)\nif o := tsdb.OverlappingBlocks(metas); len(o) > 0 {\n    return fmt.Errorf(\"pre-flight overlap check failed: %s\", o.String())\n}","typeGuard":null,"tryCatchPattern":"err := checker.IsOverlapping(ctx, meta)\nif err != nil {\n    if strings.Contains(err.Error(), \"overlap spotted\") {\n        // inspect o.String() ULIDs and resolve duplicates before re-syncing\n        log.Printf(\"blocked compacted block %s: %v\", meta.ULID, err)\n    }\n}","preventionTips":["Avoid overlapping retention/compaction settings in Prometheus","Only run one sidecar per TSDB data directory","Validate backfilled data ranges against existing bucket blocks before import","Use `thanos tools bucket inspect` to audit block time ranges"],"tags":["compaction","overlap","thanos-blocks","data-integrity"],"backgroundTag":"invalid-state-transition","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"}