{"record":{"id":"afe222c6f8e59b5a","repo":"thanos-io/thanos","slug":"non-sequential-chunks-not-equal-x-and-x","errorCode":null,"errorMessage":"non-sequential chunks not equal: %x and %x","messagePattern":"non-sequential chunks not equal: %x and %x","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/index.go","lineNumber":523,"sourceCode":"\tif last == nil {\n\t\treturn false, nil\n\t}\n\n\tif curr.MinTime > last.MaxTime {\n\t\treturn false, nil\n\t}\n\n\t// Verify that the overlapping chunks are exact copies so we can safely discard\n\t// the current one.\n\tif curr.MinTime != last.MinTime || curr.MaxTime != last.MaxTime {\n\t\treturn false, errors.Errorf(\"non-sequential chunks not equal: [%d, %d] and [%d, %d]\",\n\t\t\tlast.MinTime, last.MaxTime, curr.MinTime, curr.MaxTime)\n\t}\n\tca := crc32.Checksum(last.Chunk.Bytes(), castagnoli)\n\tcb := crc32.Checksum(curr.Chunk.Bytes(), castagnoli)\n\n\tif ca != cb {\n\t\treturn false, errors.Errorf(\"non-sequential chunks not equal: %x and %x\", ca, cb)\n\t}\n\n\treturn true, nil\n}\n\n// sanitizeChunkSequence ensures order of the input chunks and drops any duplicates.\n// It errors if the sequence contains non-dedupable overlaps.\nfunc sanitizeChunkSequence(chks []chunks.Meta, mint, maxt int64, ignoreChkFns []ignoreFnType) ([]chunks.Meta, error) {\n\tif len(chks) == 0 {\n\t\treturn nil, nil\n\t}\n\t// First, ensure that chunks are ordered by their start time.\n\tsort.Slice(chks, func(i, j int) bool {\n\t\treturn chks[i].MinTime < chks[j].MinTime\n\t})\n\n\t// Remove duplicates, complete outsiders and near outsiders.\n\trepl := make([]chunks.Meta, 0, len(chks))","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/index.go#L505-L541","documentation":"A data-integrity guard in IgnoreDuplicateOutsideChunk: two chunks overlap in time (curr.MinTime <= last.MaxTime) but are not exact duplicates — their [mint,maxt] windows differ, or (in the sibling checksum branch) their bytes hash differently. Deduplication by discarding the later chunk would lose data, so the repair is refused rather than silently corrupting the block.","triggerScenarios":"Thrown at pkg/block/index.go:523 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat as data divergence — investigate replica sources","Prefer vertical compaction to keep both copies","Avoid manual chunk dropping"],"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"}