{"record":{"id":"bef7ade76595c7f2","repo":"apache/cassandra","slug":"failed-to-seek-to-next-partition-position-d","errorCode":null,"errorMessage":"Failed to seek to next partition position %d","messagePattern":"Failed to seek to next partition position (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/io/sstable/format/big/BigTableScrubber.java","lineNumber":256,"sourceCode":"\n    private boolean indexAvailable()\n    {\n        return indexFile != null && !indexFile.isEOF();\n    }\n\n    private boolean seekToNextPartition()\n    {\n        while (nextPartitionPositionFromIndex < dataFile.length())\n        {\n            try\n            {\n                dataFile.seek(nextPartitionPositionFromIndex);\n                return true;\n            }\n            catch (Throwable th)\n            {\n                throwIfFatal(th);\n                outputHandler.warn(th, \"Failed to seek to next partition position %d\", nextPartitionPositionFromIndex);\n                badPartitions++;\n            }\n\n            updateIndexKey();\n        }\n\n        return false;\n    }\n\n    @Override\n    protected void throwIfCannotContinue(DecoratedKey key, Throwable th)\n    {\n        if (isIndex)\n        {\n            outputHandler.warn(\"An error occurred while scrubbing the partition with key '%s' for an index table. \" +\n                               \"Scrubbing will abort for this table and the index will be rebuilt.\", keyString(key));\n            throw new IOError(th);\n        }","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/format/big/BigTableScrubber.java#L238-L274","documentation":"seekToNextPartition failed to position the data reader at the position taken from the index (nextPartitionPositionFromIndex). The scrubber logs the error, increments badPartitions, and updates the index cursor to try the following partition, skipping over the unreadable region.","triggerScenarios":"seekToNextPartition (called from scrubInternal) catches a Throwable after dataFile.seek(nextPartitionPositionFromIndex) or during the surrounding read — position out of file bounds, I/O error, or a corrupt index-derived position.","commonSituations":"Index positions pointing past a truncated data file, corrupt row-index entries giving bogus offsets, disk I/O failures mid-scrub.","solutions":["Let the scrubber skip ahead and finish; bad partitions are counted and reported","Run `nodetool repair` afterwards to restore skipped partitions from replicas","Replace the sstable pair (Data+Index) from a snapshot or healthy replica","Validate data file length vs index entries with `nodetool verify` before scrubbing"],"exampleFix":"// before: seek to bogus index position fails\noutputHandler.warn(th, \"Failed to seek to next partition position %d\", nextPartitionPositionFromIndex);\n// after: bound-check positions against data file length\nif (nextPartitionPositionFromIndex > dataFile.length())\n    outputHandler.warn(\"Skipping invalid index position %d > %d\", nextPartitionPositionFromIndex, dataFile.length());","handlingStrategy":"try-catch","validationCode":"long pos = nextPartitionPositionFromIndex;\nif (pos < 0 || pos > dataFile.length())\n    logger.warn(\"Index position {} out of bounds for data file length {}\", pos, dataFile.length());","typeGuard":null,"tryCatchPattern":"try {\n    dataFile.seek(nextPartitionPositionFromIndex);\n} catch (IOException e) {\n    badPartitions++;\n    logger.warn(\"Cannot seek to {}; advancing index cursor\", nextPartitionPositionFromIndex, e);\n    updateIndexKey();\n}","preventionTips":["Check for truncated data files (data length < max index position) before scrub","Run `nodetool verify` to catch inconsistent row-index entries","Replace Data+Index pairs together, never individually","Repair after scrub to restore skipped partitions"],"tags":["cassandra","sstable","index","seek-failure"],"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-17T15:17:12.973Z"}