{"record":{"id":"ff173cd72be1f1bb","repo":"apache/cassandra","slug":"invalid-large-columns-subset-present-index-idx","errorCode":null,"errorMessage":"Invalid large Columns subset: present index ${idx} of ${supersetCount}","messagePattern":"Invalid large Columns subset: present index (.+?) of (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/io/sstable/UnfilteredDescriptor.java","lineNumber":214,"sourceCode":"            presentColumnsWords = new long[nWords];\n\n        if (columnCount < supersetCount / 2)\n            readPresentColumnIndexes(dataReader, supersetCount, nWords, columnCount);\n        else\n            readMissingColumnIndexes(dataReader, supersetCount, nWords, delta);\n\n        useColumnsWords = true;\n        missingColumnsMask = 0;\n    }\n\n    private void readPresentColumnIndexes(RandomAccessReader dataReader, int supersetCount, int nWords, int columnCount) throws IOException\n    {\n        java.util.Arrays.fill(presentColumnsWords, 0, nWords, 0L);\n        for (int i = 0; i < columnCount; i++)\n        {\n            int idx = dataReader.readUnsignedVInt32();\n            if (idx < 0 || idx >= supersetCount)\n                throw new IOException(\"Invalid large Columns subset: present index \" + idx + \" of \" + supersetCount);\n            presentColumnsWords[idx >>> 6] |= 1L << (idx & 63);\n        }\n    }\n\n    /** The last word starts trimmed to the column range. A delta of 0 clears nothing. */\n    private void readMissingColumnIndexes(RandomAccessReader dataReader, int supersetCount, int nWords, int delta) throws IOException\n    {\n        java.util.Arrays.fill(presentColumnsWords, 0, nWords, -1L);\n        if ((supersetCount & 63) != 0)\n            presentColumnsWords[nWords - 1] = -1L >>> (64 - (supersetCount & 63));\n        for (int i = 0; i < delta; i++)\n        {\n            int idx = dataReader.readUnsignedVInt32();\n            if (idx < 0 || idx >= supersetCount)\n                throw new IOException(\"Invalid large Columns subset: missing index \" + idx + \" of \" + supersetCount);\n            presentColumnsWords[idx >>> 6] &= ~(1L << (idx & 63));\n        }\n    }","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/UnfilteredDescriptor.java#L196-L232","documentation":"Thrown by UnfilteredDescriptor.readPresentColumnIndexes when deserializing the 'present columns' bitmap of a large-columns subset encoding: an index read from the data stream is negative or >= the superset column count. This means the on-disk bytes are inconsistent with the Columns superset metadata — i.e. the SSTable component is corrupt, truncated, or was written by an incompatible format version. It surfaces as an IOException during partition deserialization.","triggerScenarios":"Reading an SSTable row whose serialization header declares a large column superset, while the encoded present-index vint stream contains an out-of-range index (corrupt/truncated data file, wrong serialization header, bit-flip or partial write).","commonSituations":"Hardware corruption or incomplete writes to data.db; copying/mixing SSTable files from different snapshots or Cassandra versions; restoring a backup where data.db and serialization header mismatch; disk full during flush.","solutions":["Run nodetool scrub (or sstablescrub) on the affected keyspace/table to repair or quarantine the corrupt SSTable","Restore the affected SSTable from a verified backup/snapshot and let repair/anti-entropy rebuild the data","Run sstablemetadata / sstableverify on the file to confirm which component is corrupt before deleting","Check disk health and filesystem errors (dmesg, SMART) and verify disk space to rule out failed flushes"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before opening: validate SSTable components\nsstableverify -- <keyspace> <table>  // or use sstablemetadata on each Descriptor\ndescriptor.fileFor(Component.DATA).exists();","typeGuard":null,"tryCatchPattern":"try (UnfilteredRowIterator it = sstable.iterator(...)) { ... }\ncatch (CorruptSSTableException | IOException e) {\n    logger.error(\"Corrupt SSTable {}, quarantine and repair\", sstable, e);\n    // mark bad, trigger nodetool scrub/repair\n}","preventionTips":["Always copy SSTables as a complete snapshot (nodetool snapshot) including all components","Run sstableverify/sstablemetadata after restores before bringing files online","Monitor disk health (SMART, dmesg) and keep free space headroom for flushes","Keep all nodes on the same Cassandra version to avoid format mismatches"],"tags":["sstable","corruption","io","deserialization"],"backgroundTag":"checksum-mismatch","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}