apache/cassandra · warning

Last record of transaction

Error message

Last record of transaction {} is corrupt or incomplete [{}], but all previous records match state on disk; continuing

What it means

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.

Solutions

  1. No action required if startup completes — the warning is informational by design.
  2. Verify data integrity for the affected sstables (nodetool scrub / verify) if concerned.
  3. Check the OS/hypervisor logs for the crash that caused the torn write and address the instability.
  4. If the warning repeats with data loss symptoms, restore the affected tables from backup.
Defensive patterns

Strategy: try-catch

Try / catch

try { node.start(); }
catch (StartupException e) {
    // distinguish benign torn-last-record warn from hard verification failure
    if (e.getCause() instanceof LogVerificationException) restoreFromBackup();
    else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Hard power loss or OOM-kill of a node; container being stopped ungracefully; disk truncating the final write of the log file.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/197fd37aaf9eae26. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/db/lifecycle/LogFile.java:241

        {
            setErrorInReplicas(failedOn);
            return false;
        }

        records.stream().filter((r) -> r != failedOn).forEach(LogFile::verifyRecordWithCorruptedLastRecord);
        if (records.stream()
                   .filter((r) -> r != failedOn)
                   .filter(LogRecord::isInvalid)
                   .map(this::setErrorInReplicas)
                   .findFirst().isPresent())
        {
            setErrorInReplicas(failedOn);
            return false;
        }

        // if only the last record is corrupt and all other records have matching files on disk, @see verifyRecord,
        // then we simply exited whilst serializing the last record and we carry on
        logger.warn("Last record of transaction {} is corrupt or incomplete [{}], " +
                    "but all previous records match state on disk; continuing",
                    id, failedOn.error());
        return true;
    }

    LogRecord setErrorInReplicas(LogRecord record)
    {
        replicas.setErrorInReplicas(record);
        return record;
    }

    /**
     * Sets the {@link LogRecord.Status#error} if something wrong is found with the record.
     */
    static void verifyRecord(LogRecord record, List<File> existingFiles)
    {
        if (record.checksum != record.computeChecksum())
        {

View on GitHub (pinned to 88fd0f6a0e)