apache/cassandra · error
Error reading partition %s (stacktrace follows):
Error message
Error reading partition %s (stacktrace follows):
What it means
The scrubber caught a non-fatal Throwable while deserializing a partition from the data file. It logs the error with stacktrace via the output handler, then (when index data is available) attempts to retry the partition from the index-recorded position instead of failing the whole scrub.
Source
Thrown at src/java/org/apache/cassandra/io/sstable/format/big/BigTableScrubber.java:175
{
throw new IOError(new IOException(String.format("Key from data file (%s) does not match key from index file (%s)",
//ByteBufferUtil.bytesToHex(key.getKey()), ByteBufferUtil.bytesToHex(currentIndexKey))));
"_too big_", ByteBufferUtil.bytesToHex(currentIndexKey))));
}
if (indexFile != null && dataSizeFromIndex > dataFile.length())
throw new IOError(new IOException("Impossible partition size (greater than file length): " + dataSizeFromIndex));
if (indexFile != null && dataStart != dataStartFromIndex)
outputHandler.warn("Data file partition position %d differs from index file row position %d", dataStart, dataStartFromIndex);
if (tryAppend(prevKey, key, writer))
prevKey = key;
}
catch (Throwable th)
{
throwIfFatal(th);
outputHandler.warn(th, "Error reading partition %s (stacktrace follows):", keyName);
if (currentIndexKey != null
&& (key == null || !key.getKey().equals(currentIndexKey) || dataStart != dataStartFromIndex))
{
outputHandler.output("Retrying from partition index; data is %s bytes starting at %s",
dataSizeFromIndex, dataStartFromIndex);
key = sstable.decorateKey(currentIndexKey);
try
{
if (!tableMetadata.isIndex())
tableMetadata.partitionKeyType.validate(key.getKey());
dataFile.seek(dataStartFromIndex);
if (tryAppend(prevKey, key, writer))
prevKey = key;
}
catch (Throwable th2)View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Read the logged stacktrace to identify the corruption type (EOF vs CRC vs deserialize)
- Re-run scrub letting it skip bad partitions, then run `nodetool repair` to restore lost data
- Restore the affected sstable from a snapshot or another replica
- Run `nodetool verify` to scope the corruption and check compression checksums
Example fix
// before: scrubbing a corrupt partition throws and warns // after: run verify first to scope damage nodetool verify keyspace table; nodetool scrub keyspace table; nodetool repair keyspace table;
Defensive patterns
Strategy: try-catch
Try / catch
try {
scrubPartition(dataFile);
} catch (CorruptSSTableException | IOException e) {
logger.warn("Skipping corrupt partition at {} in {}", dataFile.getFilePointer(), sstable, e);
skipToNextPartition();
} Prevention
- Run `nodetool verify` regularly to catch corruption early
- Use checksummed sstable formats (modern versions checksum compression chunks)
- Keep replicas (RF >= 3) so repair can restore skipped partitions
- Enable filesystem checksums to detect bit-rot
When it happens
Trigger: scrubInternal throws while reading a partition (CorruptSSTableException, EOFException, IOError) — corrupted bytes in the -Data.db at the current partition, or a cell deserialization error.
Common situations: Bit-rot on disk, truncated data files after crashes, corrupt compression chunks, or cells written by an incompatible format version.
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 set
- Invalid Columns subset bytes; too many bits set: ${encoded}
- Invalid large Columns subset: missing count ${encoded} of ${
- Unable to read partition key from data file
- Key from data file (%s) does not match key from index file (
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/7b2fa707e334f067.
Report an issue: GitHub.