apache/cassandra · critical · CorruptSSTableException

CorruptSSTableException (wrapped corruption: IndexOutOfBound

Error message

CorruptSSTableException (wrapped corruption: IndexOutOfBoundsException | VIntOutOfRangeException | AssertionError, with sstable filename)

What it means

SSTableIdentityIterator.next() computes the next row during iteration; if parsing throws IndexOutOfBoundsException, VIntOutOfRangeException, or AssertionError, the sstable is marked suspect and a CorruptSSTableException with the sstable filename is thrown. This converts structural corruption of the serialized row data into Cassandra's canonical corruption error.

Source

Thrown at src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java:228

            {
                throw e;
            }
        }
    }

    public Unfiltered next()
    {
        try
        {
            if (isClosed)
                throw new IllegalStateException("Iterator used after closing.");

            return doCompute();
        }
        catch (IndexOutOfBoundsException | VIntOutOfRangeException | AssertionError e)
        {
            sstable.markSuspect();
            throw new CorruptSSTableException(e, filename);
        }
        catch (CorruptSSTableException e) // to ensure that we marked the sstable as suspected if CorruptSSTableException is thrown from lower levels
        {
            sstable.markSuspect();
            throw e;
        }
        catch (IOError e)
        {
            if (e.getCause() instanceof IOException)
            {
                sstable.markSuspect();
                throw new CorruptSSTableException((Exception)e.getCause(), filename);
            }
            else
            {
                throw e;
            }
        }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Run `nodetool scrub` on the table to remove or quarantine the corrupt sstable
  2. Restore from backup or run `nodetool repair` to replace data lost from the corrupt sstable
  3. Check Cassandra version compatibility for the offending sstable and run `nodetool upgradesstables` if required
  4. Audit disk health (SMART, dmesg) and replace failing storage to prevent recurrence

Example fix

// before: repeatedly hitting the same corrupt sstable
// after: scrub and repair
nodetool scrub -- keyspace table
nodetool repair -- keyspace table
Defensive patterns

Strategy: try-catch

Validate before calling

// validate sstable integrity before row reads
// sstablemetadata + nodetool verify detect malformed sstables up front
verifySstable(filename); // out-of-band check

Try / catch

try {
    Row row = iter.next();
} catch (CorruptSSTableException e) {
    logger.error("Corrupt row data in sstable {}", e.getPath(), e);
    // discard iterator, read from another replica, scrub table
}

Prevention

When it happens

Trigger: Calling next() while streaming rows when the row deserializer encounters malformed bytes: an index overrun from a truncated row, an invalid VInt length prefix, or a failed structural assertion inside the unfiltered serializer.

Common situations: Sstables corrupted by bad disks; files written by a newer/older incompatible version; crash-damaged sstables from unclean shutdown; corruption introduced when copying sstables manually between environments.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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