apache/cassandra · critical · CorruptSSTableException

Key <key> in <keyspace>.<table> is invalid in <sstable>: <in

Error message

Key <key> in <keyspace>.<table> is invalid in <sstable>: <invalidContent>

What it means

UnfilteredValidation.handleInvalid reacts to unreadable/invalid data found while reading an sstable. Under CorruptedTombstoneStrategy.disable the sstable is marked suspect and a CorruptSSTableException (wrapping MarshalException) is thrown with a message describing the invalid key/content. Under warn strategy the same message is only logged. Marking the sstable suspect excludes it from future compactions so bad data does not propagate.

Source

Thrown at src/java/org/apache/cassandra/db/UnfilteredValidation.java:101

            keyString = metadata.partitionKeyType.getString(key.getKey());
        }
        catch (Throwable t)
        {
            keyString = "[corrupt token="+key.getToken()+"]";
        }

        if (strat == Config.CorruptedTombstoneStrategy.exception)
        {
            String msg = String.format("Key %s in %s.%s is invalid in %s: %s",
                                       keyString,
                                       metadata.keyspace,
                                       metadata.name,
                                       sstable,
                                       invalidContent);
            // we mark suspect to make sure this sstable is not included in future compactions - it would just keep
            // throwing exceptions
            sstable.markSuspect();
            throw new CorruptSSTableException(new MarshalException(msg), sstable.getFilename());
        }
        else if (strat == Config.CorruptedTombstoneStrategy.warn)
        {
            String msgTemplate = String.format("Key {} in %s.%s is invalid in %s: {}",
                                               metadata.keyspace,
                                               metadata.name,
                                               sstable);
            nospam1m.warn(msgTemplate, keyString, invalidContent);
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Run `nodetool scrub keyspace table` to rewrite the table dropping corrupt rows, or restore the affected sstable from a verified backup
  2. Investigate the underlying MarshalException cause in logs to identify which cells/keys are invalid and whether hardware is failing
  3. If the invalid data is knowingly tolerated, set corrupted_tombstone_strategy: warn in cassandra.yaml so it logs instead of throwing (risk: silent corruption)
  4. Check dmesg/SMART data for disk errors on the node holding the sstable

Example fix

// before (cassandra.yaml)
corrupted_tombstone_strategy: disabled
// after
corrupted_tombstone_strategy: warn   # or scrub the sstable to remove bad rows
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try { readPartition(...); } catch (CorruptSSTableException e) { log.error("Corrupt sstable {}", e.getFilename(), e); /* trigger scrub or restore from backup */ }

Prevention

When it happens

Trigger: Reading a partition whose key or unfiltered content fails validation (invalid partition key bytes, malformed cells/tombstones) from an sstable while tombstone corruption checking is set to disabled, e.g. during a read or compaction pass.

Common situations: Disk-level bit rot; sstables corrupted by an old bug or interrupted writes; corrupt_sstable_tombstone_strategy misconfigured; reading data written by an incompatible version.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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