benbjohnson/litestream · error
cannot resume follow mode: database exists but no -txid file
Error message
cannot resume follow mode: database exists but no -txid file found; delete the database to re-restore: %s
What it means
Follow-mode resume guard: the output database exists but its TXID sidecar file contains TXID 0 (or is effectively absent). Litestream cannot tell where to resume applying LTX files, so it refuses rather than risk double-applying transactions.
Source
Thrown at replica.go:631
return fmt.Errorf("cannot specify index & timestamp to restore")
} else if opt.Follow && opt.TXID != 0 {
return fmt.Errorf("cannot use follow mode with -txid")
} else if opt.Follow && !opt.Timestamp.IsZero() {
return fmt.Errorf("cannot use follow mode with -timestamp")
} else if opt.IntegrityCheck != IntegrityCheckNone && opt.IntegrityCheck != IntegrityCheckQuick && opt.IntegrityCheck != IntegrityCheckFull {
return fmt.Errorf("unsupported integrity check mode: %d", opt.IntegrityCheck)
}
// In follow mode, if the database already exists, attempt crash recovery
// by reading the last applied TXID from the sidecar file.
if opt.Follow {
if _, statErr := os.Stat(opt.OutputPath); statErr == nil {
txid, readErr := ReadTXIDFile(opt.OutputPath)
if readErr != nil {
return fmt.Errorf("read txid file for crash recovery: %w", readErr)
}
if txid == 0 {
return fmt.Errorf("cannot resume follow mode: database exists but no -txid file found; delete the database to re-restore: %s", opt.OutputPath)
}
// Validate saved TXID is still reachable. If the earliest snapshot
// starts after our saved TXID, retention has pruned the history
// and we can't catch up incrementally.
snapshotItr, itrErr := r.Client.LTXFiles(ctx, SnapshotLevel, 0, false)
if itrErr != nil {
return fmt.Errorf("cannot validate saved TXID for crash recovery: %w", itrErr)
}
var latestSnapshot *ltx.FileInfo
for snapshotItr.Next() {
latestSnapshot = snapshotItr.Item()
}
if err := snapshotItr.Err(); err != nil {
_ = snapshotItr.Close()
return fmt.Errorf("iterate snapshots for crash recovery validation: %w", err)
}
_ = snapshotItr.Close()View on GitHub (pinned to 4ed7a308f6)
Solutions
- Delete the database and its -txid file, then re-restore
- Or write a valid -txid sidecar with the correct last-applied TXID
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at replica.go:631 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of benbjohnson/litestream@4ed7a308f6 (2026-09-06).
Data as JSON: /api/errors/3637c2b4ace6b232.
Report an issue: GitHub.