{"record":{"id":"e4dc5e8eb511d73e","repo":"apache/cassandra","slug":"key-key-in-keyspace-table-is-invalid-in-sst","errorCode":null,"errorMessage":"Key <key> in <keyspace>.<table> is invalid in <sstable>: <invalidContent>","messagePattern":"Key <key> in <keyspace>\\.<table> is invalid in <sstable>: <invalidContent>","errorType":"exception","errorClass":"CorruptSSTableException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/db/UnfilteredValidation.java","lineNumber":101,"sourceCode":"            keyString = metadata.partitionKeyType.getString(key.getKey());\n        }\n        catch (Throwable t)\n        {\n            keyString = \"[corrupt token=\"+key.getToken()+\"]\";\n        }\n\n        if (strat == Config.CorruptedTombstoneStrategy.exception)\n        {\n            String msg = String.format(\"Key %s in %s.%s is invalid in %s: %s\",\n                                       keyString,\n                                       metadata.keyspace,\n                                       metadata.name,\n                                       sstable,\n                                       invalidContent);\n            // we mark suspect to make sure this sstable is not included in future compactions - it would just keep\n            // throwing exceptions\n            sstable.markSuspect();\n            throw new CorruptSSTableException(new MarshalException(msg), sstable.getFilename());\n        }\n        else if (strat == Config.CorruptedTombstoneStrategy.warn)\n        {\n            String msgTemplate = String.format(\"Key {} in %s.%s is invalid in %s: {}\",\n                                               metadata.keyspace,\n                                               metadata.name,\n                                               sstable);\n            nospam1m.warn(msgTemplate, keyString, invalidContent);\n        }\n    }\n}\n","sourceCodeStart":83,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/UnfilteredValidation.java#L83-L113","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `nodetool scrub keyspace table` to rewrite the table dropping corrupt rows, or restore the affected sstable from a verified backup","Investigate the underlying MarshalException cause in logs to identify which cells/keys are invalid and whether hardware is failing","If the invalid data is knowingly tolerated, set corrupted_tombstone_strategy: warn in cassandra.yaml so it logs instead of throwing (risk: silent corruption)","Check dmesg/SMART data for disk errors on the node holding the sstable"],"exampleFix":"// before (cassandra.yaml)\ncorrupted_tombstone_strategy: disabled\n// after\ncorrupted_tombstone_strategy: warn   # or scrub the sstable to remove bad rows","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try { readPartition(...); } catch (CorruptSSTableException e) { log.error(\"Corrupt sstable {}\", e.getFilename(), e); /* trigger scrub or restore from backup */ }","preventionTips":["Run regular sstableverify/scrub maintenance","Monitor for disk errors (SMART, dmesg) on data volumes","Choose corrupted_tombstone_strategy deliberately: warn to tolerate, disabled to fail fast","Restore from verified backups instead of serving corrupt data"],"tags":["corruption","sstable","validation","data-integrity"],"backgroundTag":"schema-validation-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}