{"record":{"id":"76b463bac7ba9f59","repo":"apache/cassandra","slug":"failed-to-go-to-the-next-entry-in-index","errorCode":null,"errorMessage":"Failed to go to the next entry in index","messagePattern":"Failed to go to the next entry in index","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/io/sstable/format/bti/BtiTableScrubber.java","lineNumber":280,"sourceCode":"            try\n            {\n                dataFile.seek(nextRowPositionFromIndex);\n                return true;\n            }\n            catch (Throwable th)\n            {\n                throwIfFatal(th);\n                outputHandler.warn(th, \"Failed to seek to next row position %d\", nextRowPositionFromIndex);\n                badPartitions++;\n            }\n\n            try\n            {\n                indexIterator.advance();\n            }\n            catch (Throwable th)\n            {\n                outputHandler.warn(th, \"Failed to go to the next entry in index\");\n                throw Throwables.cleaned(th);\n            }\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        }\n\n        super.throwIfCannotContinue(key, th);","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/format/bti/BtiTableScrubber.java#L262-L298","documentation":"In seekToNextPartition, after failing to seek in the data file, the scrubber attempts indexIterator.advance() to move to the next index entry. If that throws, this warning is logged and the exception is rethrown cleaned, aborting the scrub loop — neither the data file nor the index can be advanced, so no further recovery is possible.","triggerScenarios":"`nodetool scrub` on a BTI sstable where both data seek failed and PartitionIndex.advance() throws — deeply corrupt index trie or unreadable index file blocks.","commonSituations":"Severely corrupted sstables after disk failure; index file truncated or zero-length while Data.db has content; restore mixing incompatible index and data components.","solutions":["Do not retry scrub on these files; they are beyond in-place recovery.","Restore the sstable set from a snapshot/backup and run `nodetool repair` to reconcile with replicas.","If only some sstables are affected, move corrupt files out of the data directory, run repair, then remove the quarantined files.","Check storage subsystem health before returning the node to service."],"exampleFix":"// Quarantine instead of forcing scrub:\n// before: repeated scrub failures on same sstable\n// after:\n$ nodetool drain\n$ mv <bad-sstable-components> /tmp/quarantine/\n$ nodetool repair <keyspace> <table>","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Abort maintenance on unrecoverable scrub failures and restore from backup\ntry {\n    scrubber.scrub();\n} catch (Throwable t) {\n    // scrub rethrows cleaned fatal index errors; stop, quarantine, restore\n    logger.error(\"Scrub unrecoverable; restore from snapshot and repair\", t);\n}","preventionTips":["Always keep a recent validated snapshot before running scrub on suspect sstables.","Quarantine repeatedly failing sstables instead of retrying scrub indefinitely.","Ensure replication exists elsewhere before deleting/quarantining local sstables.","Investigate storage health after any scrub-abort; it usually means physical corruption."],"tags":["cassandra","scrub","sstable","corrupt-index"],"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"}