{"record":{"id":"197fd37aaf9eae26","repo":"apache/cassandra","slug":"last-record-of-transaction-is-corrupt-or-incomp","errorCode":null,"errorMessage":"Last record of transaction {} is corrupt or incomplete [{}], but all previous records match state on disk; continuing","messagePattern":"Last record of transaction (.+?) is corrupt or incomplete \\[(.+?)\\], but all previous records match state on disk; continuing","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/db/lifecycle/LogFile.java","lineNumber":241,"sourceCode":"        {\n            setErrorInReplicas(failedOn);\n            return false;\n        }\n\n        records.stream().filter((r) -> r != failedOn).forEach(LogFile::verifyRecordWithCorruptedLastRecord);\n        if (records.stream()\n                   .filter((r) -> r != failedOn)\n                   .filter(LogRecord::isInvalid)\n                   .map(this::setErrorInReplicas)\n                   .findFirst().isPresent())\n        {\n            setErrorInReplicas(failedOn);\n            return false;\n        }\n\n        // if only the last record is corrupt and all other records have matching files on disk, @see verifyRecord,\n        // then we simply exited whilst serializing the last record and we carry on\n        logger.warn(\"Last record of transaction {} is corrupt or incomplete [{}], \" +\n                    \"but all previous records match state on disk; continuing\",\n                    id, failedOn.error());\n        return true;\n    }\n\n    LogRecord setErrorInReplicas(LogRecord record)\n    {\n        replicas.setErrorInReplicas(record);\n        return record;\n    }\n\n    /**\n     * Sets the {@link LogRecord.Status#error} if something wrong is found with the record.\n     */\n    static void verifyRecord(LogRecord record, List<File> existingFiles)\n    {\n        if (record.checksum != record.computeChecksum())\n        {","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/lifecycle/LogFile.java#L223-L259","documentation":"LogFile.verify validates a pending/commit transaction log against files on disk. When only the LAST record is corrupt or incomplete (typically because the node exited mid-serialization of that record) but all earlier records match disk state, Cassandra logs this warning and continues startup instead of failing, since the truncation is benign.","triggerScenarios":"Node crash or kill -9 while a transaction log record was being written; incomplete final line in a txn log file (e.g. in system_table/staging or commitlog-adjacent sstable lifecycle logs) discovered during readTxnLog at startup or at log completion.","commonSituations":"Hard power loss or OOM-kill of a node; container being stopped ungracefully; disk truncating the final write of the log file.","solutions":["No action required if startup completes — the warning is informational by design.","Verify data integrity for the affected sstables (nodetool scrub / verify) if concerned.","Check the OS/hypervisor logs for the crash that caused the torn write and address the instability.","If the warning repeats with data loss symptoms, restore the affected tables from backup."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { node.start(); }\ncatch (StartupException e) {\n    // distinguish benign torn-last-record warn from hard verification failure\n    if (e.getCause() instanceof LogVerificationException) restoreFromBackup();\n    else throw e;\n}","preventionTips":["Shut down nodes gracefully (nodetool drain then stop).","Use persistent disks that honor fsync to avoid torn writes.","After crashes, run nodetool verify on affected tables."],"tags":["txn-log","startup","crash-recovery","disk"],"backgroundTag":"checksum-mismatch","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"}