apache/cassandra · warning
Failed to advance to the next index position. Index is…
Error message
Failed to advance to the next index position. Index is corrupted. Continuing without the index. Last position read is %d.
What it means
While scrubbing with the BTI partition index, the scrubber advances the index iterator between partitions. If advancing throws (the index entries point at unreadable or inconsistent positions), the scrubber logs this warning, closes the index, and continues scrubbing the data file sequentially without index guidance. The message includes the last data position successfully read from the index to aid diagnosis.
Solutions
- Continue the scrub — it proceeds without the index and quarantines/repairs bad partitions.
- After scrub completes, run `nodetool compact` on the table to rebuild a clean index.
- Restore the affected sstables from a verified backup or repair the node with `nodetool repair`.
- Investigate storage-layer corruption (fsck, SMART, RAID checks) on the data directory.
Example fix
// Operational fix, not code: // before: scrub warns 'Failed to advance to the next index position' and drops the index // after: rebuild the sstable/index and verify $ nodetool scrub <keyspace> <table> $ nodetool compact <keyspace> <table>
Defensive patterns
Strategy: fallback
Validate before calling
// Check sstable components exist and are non-trivial before scrub $ sstablemetadata <path>/xx-Data.db # errors out on unreadable/corrupt sstable $ ls -l <path>/xx-Index.db # should not be 0 bytes when Data.db is non-empty
Prevention
- Keep Data.db and Index.db components from the same generation together when restoring.
- Enable periodic scrub on a schedule to detect corruption proactively.
- Watch node logs for earlier index warnings during flush/compaction.
- Use verified snapshots for backups, not live file copies.
When it happens
Trigger: `nodetool scrub` iterating PartitionIndex entries on a BTI sstable where indexIterator.advance() throws due to truncated or corrupt index blocks, bad pointers in the trie, or data/index length mismatch.
Common situations: Incomplete compaction or flush leaves after a crash; corrupt sstables restored from backups; disks with silent corruption; manually truncated sstable files.
Understand the failure class
Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.
Related errors
- Failed to go to the next entry in index
- First position reported by index should be 0, was
- Data file partition position
- Data file partition position
- Error reading partition
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/651f31724789aa3b.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/io/sstable/format/bti/BtiTableScrubber.java:154
// size of the partition (including partition key)
long dataSizeFromIndex = -1;
ByteBuffer currentIndexKey = null;
if (indexAvailable())
{
currentIndexKey = indexIterator.key();
dataStartFromIndex = indexIterator.dataPosition();
if (!indexIterator.isExhausted())
{
try
{
indexIterator.advance();
if (!indexIterator.isExhausted())
dataSizeFromIndex = indexIterator.dataPosition() - dataStartFromIndex;
}
catch (Throwable th)
{
throwIfFatal(th);
outputHandler.warn(th,
"Failed to advance to the next index position. Index is corrupted. " +
"Continuing without the index. Last position read is %d.",
indexIterator.dataPosition());
indexIterator.close();
indexIterator = null;
currentIndexKey = null;
dataStartFromIndex = -1;
dataSizeFromIndex = -1;
}
}
}
String keyName = key == null ? "(unreadable key)" : keyString(key);
outputHandler.debug("partition %s is %s", keyName, FBUtilities.prettyPrintMemory(dataSizeFromIndex));
try
{
if (key == null)View on GitHub (pinned to 88fd0f6a0e)