{"record":{"id":"90f45f2ce0abc661","repo":"apache/cassandra","slug":"corruptsstableexception-wrapped-corruption-index","errorCode":null,"errorMessage":"CorruptSSTableException (wrapped corruption: IndexOutOfBoundsException | VIntOutOfRangeException | AssertionError, with sstable filename)","messagePattern":"CorruptSSTableException \\(wrapped corruption: IndexOutOfBoundsException \\| VIntOutOfRangeException \\| AssertionError, with sstable filename\\)","errorType":"exception","errorClass":"CorruptSSTableException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java","lineNumber":228,"sourceCode":"            {\n                throw e;\n            }\n        }\n    }\n\n    public Unfiltered next()\n    {\n        try\n        {\n            if (isClosed)\n                throw new IllegalStateException(\"Iterator used after closing.\");\n\n            return doCompute();\n        }\n        catch (IndexOutOfBoundsException | VIntOutOfRangeException | AssertionError e)\n        {\n            sstable.markSuspect();\n            throw new CorruptSSTableException(e, filename);\n        }\n        catch (CorruptSSTableException e) // to ensure that we marked the sstable as suspected if CorruptSSTableException is thrown from lower levels\n        {\n            sstable.markSuspect();\n            throw e;\n        }\n        catch (IOError e)\n        {\n            if (e.getCause() instanceof IOException)\n            {\n                sstable.markSuspect();\n                throw new CorruptSSTableException((Exception)e.getCause(), filename);\n            }\n            else\n            {\n                throw e;\n            }\n        }","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java#L210-L246","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `nodetool scrub` on the table to remove or quarantine the corrupt sstable","Restore from backup or run `nodetool repair` to replace data lost from the corrupt sstable","Check Cassandra version compatibility for the offending sstable and run `nodetool upgradesstables` if required","Audit disk health (SMART, dmesg) and replace failing storage to prevent recurrence"],"exampleFix":"// before: repeatedly hitting the same corrupt sstable\n// after: scrub and repair\nnodetool scrub -- keyspace table\nnodetool repair -- keyspace table","handlingStrategy":"try-catch","validationCode":"// validate sstable integrity before row reads\n// sstablemetadata + nodetool verify detect malformed sstables up front\nverifySstable(filename); // out-of-band check","typeGuard":null,"tryCatchPattern":"try {\n    Row row = iter.next();\n} catch (CorruptSSTableException e) {\n    logger.error(\"Corrupt row data in sstable {}\", e.getPath(), e);\n    // discard iterator, read from another replica, scrub table\n}","preventionTips":["Run nodetool scrub/verify on a schedule","Prevent unclean shutdowns; use reliable power and journaling FS","Upgrade sstables after version changes","Replace failing disks promptly; monitor I/O errors","Never modify sstable bytes manually"],"tags":["sstable","corruption","deserialization","storage"],"backgroundTag":"file-read-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"}