{"record":{"id":"7b2fa707e334f067","repo":"apache/cassandra","slug":"error-reading-partition-s-stacktrace-follows","errorCode":null,"errorMessage":"Error reading partition %s (stacktrace follows):","messagePattern":"Error reading partition (.+?) \\(stacktrace follows\\):","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/io/sstable/format/big/BigTableScrubber.java","lineNumber":175,"sourceCode":"                {\n                    throw new IOError(new IOException(String.format(\"Key from data file (%s) does not match key from index file (%s)\",\n                                                                    //ByteBufferUtil.bytesToHex(key.getKey()), ByteBufferUtil.bytesToHex(currentIndexKey))));\n                                                                    \"_too big_\", ByteBufferUtil.bytesToHex(currentIndexKey))));\n                }\n\n                if (indexFile != null && dataSizeFromIndex > dataFile.length())\n                    throw new IOError(new IOException(\"Impossible partition size (greater than file length): \" + dataSizeFromIndex));\n\n                if (indexFile != null && dataStart != dataStartFromIndex)\n                    outputHandler.warn(\"Data file partition position %d differs from index file row position %d\", dataStart, dataStartFromIndex);\n\n                if (tryAppend(prevKey, key, writer))\n                    prevKey = key;\n            }\n            catch (Throwable th)\n            {\n                throwIfFatal(th);\n                outputHandler.warn(th, \"Error reading partition %s (stacktrace follows):\", keyName);\n\n                if (currentIndexKey != null\n                    && (key == null || !key.getKey().equals(currentIndexKey) || dataStart != dataStartFromIndex))\n                {\n\n                    outputHandler.output(\"Retrying from partition index; data is %s bytes starting at %s\",\n                                         dataSizeFromIndex, dataStartFromIndex);\n                    key = sstable.decorateKey(currentIndexKey);\n                    try\n                    {\n                        if (!tableMetadata.isIndex())\n                            tableMetadata.partitionKeyType.validate(key.getKey());\n                        dataFile.seek(dataStartFromIndex);\n\n                        if (tryAppend(prevKey, key, writer))\n                            prevKey = key;\n                    }\n                    catch (Throwable th2)","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/format/big/BigTableScrubber.java#L157-L193","documentation":"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.","triggerScenarios":"scrubInternal throws while reading a partition (CorruptSSTableException, EOFException, IOError) — corrupted bytes in the -Data.db at the current partition, or a cell deserialization error.","commonSituations":"Bit-rot on disk, truncated data files after crashes, corrupt compression chunks, or cells written by an incompatible format version.","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"],"exampleFix":"// before: scrubbing a corrupt partition throws and warns\n// after: run verify first to scope damage\nnodetool verify keyspace table;\nnodetool scrub keyspace table;\nnodetool repair keyspace table;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    scrubPartition(dataFile);\n} catch (CorruptSSTableException | IOException e) {\n    logger.warn(\"Skipping corrupt partition at {} in {}\", dataFile.getFilePointer(), sstable, e);\n    skipToNextPartition();\n}","preventionTips":["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"],"tags":["cassandra","sstable","corruption","scrub"],"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-14T16:17:12.679Z"}