apache/cassandra · error · IllegalStateException

%s SSTable %s (%s) does not intersect repaired ranges %s, th

Error message

%s SSTable %s (%s) does not intersect repaired ranges %s, this sstable should not have been included.

What it means

During anti-compaction (repair), each selected SSTable is verified to intersect the repaired ranges. If none of the normalized repaired ranges intersects the SSTable's bounds, an IllegalStateException is thrown because PendingAntiCompaction#getSSTables should have filtered such SSTables out — this indicates a broken internal invariant.

Source

Thrown at src/java/org/apache/cassandra/db/compaction/CompactionManager.java:1134

        logger.info("{} Completed anticompaction successfully", PreviewKind.NONE.logPrefix(sessionID));
    }

    static void validateSSTableBoundsForAnticompaction(TimeUUID sessionID,
                                                       Collection<SSTableReader> sstables,
                                                       RangesAtEndpoint ranges)
    {
        List<Range<Token>> normalizedRanges = Range.normalize(ranges.ranges());
        for (SSTableReader sstable : sstables)
        {
            AbstractBounds<Token> bounds = sstable.getBounds();

            if (!Iterables.any(normalizedRanges, r -> (r.contains(bounds.left) && r.contains(bounds.right)) || r.intersects(bounds)))
            {
                // this should never happen - in PendingAntiCompaction#getSSTables we select all sstables that intersect the repaired ranges, that can't have changed here
                String message = String.format("%s SSTable %s (%s) does not intersect repaired ranges %s, this sstable should not have been included.",
                                               PreviewKind.NONE.logPrefix(sessionID), sstable, bounds, normalizedRanges);
                logger.error(message);
                throw new IllegalStateException(message);
            }
        }

    }

    @VisibleForTesting
    static Set<SSTableReader> findSSTablesToAnticompact(Iterator<SSTableReader> sstableIterator, List<Range<Token>> normalizedRanges, TimeUUID parentRepairSession)
    {
        Set<SSTableReader> fullyContainedSSTables = new HashSet<>();
        while (sstableIterator.hasNext())
        {
            SSTableReader sstable = sstableIterator.next();

            AbstractBounds<Token> sstableBounds = sstable.getBounds();

            for (Range<Token> r : normalizedRanges)
            {
                // ranges are normalized - no wrap around - if first and last are contained we know that all tokens are contained in the range

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Re-run the repair; transient races between SSTable selection and anti-compaction are the usual cause.
  2. Avoid triggering major compactions/cleanup concurrently with repair startup.
  3. Upgrade to a version with the pending anti-compaction race fixes (CASSANDRA-15439-era fixes).
  4. If reproducible, capture sstable metadata and ranges in the logged error and report with logs for diagnosis.
Defensive patterns

Strategy: try-catch

Validate before calling

// client-side pre-check before incremental repair
Set<Range<Token>> ranges = repairRanges; // ensure SSTable selection uses identical normalized ranges

Try / catch

try { repairCoordinator.repairAsync(keyspace, options); } catch (IllegalStateException e) { if (e.getMessage().contains("does not intersect repaired ranges")) { rerunRepairAfterQuiescing(); } }

Prevention

When it happens

Trigger: Running nodetool repair / incremental repair when the set of SSTables obtained for the repaired token ranges contains an SSTable whose bounds fall entirely outside the normalized ranges — typically due to a race where SSTables are replaced/compacted between selection and anti-compaction.

Common situations: Concurrent compaction or cleanup running during the repair preparation phase, known races in pending anti-compaction on older 4.0 versions, repair range recalculation differing from the selection-time ranges.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/79679a979eb6b11f. Report an issue: GitHub.