apache/cassandra · critical · FSReadError
Failed to read key from
Error message
Failed to read key from %s
What it means
When iterating a SASI on-disk index, KeyFetcher.apply reads the partition key at a given offset from the sstable's secondary index. An IOException during that read is wrapped in an FSReadError carrying 'Failed to read key from <descriptor>', signaling on-disk corruption or an I/O failure.
Solutions
- Check the node's system log and disk health (dmesg, smartctl); address any underlying I/O problem first.
- Run nodetool scrub on the affected table to drop or repair corrupt SSTables.
- Rebuild the SASI index: drop and recreate the index, or run nodetool upgradesstables to rewrite the SSTables.
- Restore the affected SSTables from a backup/repair (nodetool repair) if scrub does not resolve it.
Defensive patterns
Strategy: fallback
Try / catch
try {
return runSasiQuery();
} catch (FSReadError e) {
alert("SASI on-disk index read failure: " + e.getMessage());
return fallbackToNonIndexedQuery(); // or failover to a replica
} Prevention
- Monitor disk health and filesystem errors on Cassandra nodes.
- Use clean shutdowns and ensure sufficient disk headroom.
- Run nodetool scrub / repair periodically and after suspected corruption.
When it happens
Trigger: sstable.keyAtPositionFromSecondaryIndex(offset) throws IOException while fetching keys during a SASI query — truncated/corrupt index or data file, disk error, or file replaced mid-read.
Common situations: Disk corruption or bad sectors on the node; files truncated by an unclean shutdown or missing fsync; out-of-sync SSTable components after a failed compaction; filesystem full or hardware failure.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Corrupt flags value for clustering prefix (isStatic flag…
- Ballot file corrupted
- Cannot safely construct descriptor for segment, as name…
- Cannot safely construct descriptor for segment, either from…
- Checksum didn't match
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/bb2bf09c64ab3bc3.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/index/sasi/SSTableIndex.java:190
private static class DecoratedKeyFetcher implements Function<Long, DecoratedKey>
{
private final SSTableReader sstable;
DecoratedKeyFetcher(SSTableReader reader)
{
sstable = reader;
}
public DecoratedKey apply(Long offset)
{
try
{
return sstable.keyAtPositionFromSecondaryIndex(offset);
}
catch (IOException e)
{
throw new FSReadError(new IOException("Failed to read key from " + sstable.descriptor, e), sstable.getFilename());
}
}
public int hashCode()
{
return sstable.descriptor.hashCode();
}
public boolean equals(Object other)
{
return other instanceof DecoratedKeyFetcher
&& sstable.descriptor.equals(((DecoratedKeyFetcher) other).sstable.descriptor);
}
}
}
View on GitHub (pinned to 88fd0f6a0e)