{"record":{"id":"bb2bf09c64ab3bc3","repo":"apache/cassandra","slug":"failed-to-read-key-from-s","errorCode":null,"errorMessage":"Failed to read key from %s","messagePattern":"Failed to read key from (.+?)","errorType":"exception","errorClass":"FSReadError","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/index/sasi/SSTableIndex.java","lineNumber":190,"sourceCode":"\n    private static class DecoratedKeyFetcher implements Function<Long, DecoratedKey>\n    {\n        private final SSTableReader sstable;\n\n        DecoratedKeyFetcher(SSTableReader reader)\n        {\n            sstable = reader;\n        }\n\n        public DecoratedKey apply(Long offset)\n        {\n            try\n            {\n                return sstable.keyAtPositionFromSecondaryIndex(offset);\n            }\n            catch (IOException e)\n            {\n                throw new FSReadError(new IOException(\"Failed to read key from \" + sstable.descriptor, e), sstable.getFilename());\n            }\n        }\n\n        public int hashCode()\n        {\n            return sstable.descriptor.hashCode();\n        }\n\n        public boolean equals(Object other)\n        {\n            return other instanceof DecoratedKeyFetcher\n                    && sstable.descriptor.equals(((DecoratedKeyFetcher) other).sstable.descriptor);\n        }\n    }\n}\n","sourceCodeStart":172,"sourceCodeEnd":206,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sasi/SSTableIndex.java#L172-L206","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return runSasiQuery();\n} catch (FSReadError e) {\n    alert(\"SASI on-disk index read failure: \" + e.getMessage());\n    return fallbackToNonIndexedQuery(); // or failover to a replica\n}","preventionTips":["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."],"tags":["sasi","fs-read-error","corruption","io","cassandra"],"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"}