benbjohnson/litestream · error

iterate level 0 ltx files: %w

Error message

iterate level 0 ltx files: %w

What it means

After iterating, the level-0 iterator reported an error (itr.Err) in applyNewLTXFiles — the listing failed partway through. Partially-seen files are not applied; the follow loop retries on the next tick.

Source

Thrown at replica.go:921

			}
		}

		// Skip if already covered by a higher-level file.
		if info.MaxTXID <= currentTXID {
			continue
		}

		if err := r.applyLTXFile(ctx, f, info, pageSize); err != nil {
			return closeLevel0(fmt.Errorf(
				"apply ltx file (level=%d, min=%s, max=%s): %w",
				info.Level, info.MinTXID, info.MaxTXID, err,
			))
		}
		currentTXID = info.MaxTXID
	}

	if iterErr := itr.Err(); iterErr != nil {
		return closeLevel0(fmt.Errorf("iterate level 0 ltx files: %w", iterErr))
	}
	if _, err := closeLevel0(nil); err != nil {
		return currentTXID, err
	}

	if !sawLevel0 {
		bridgedTXID, err := r.fillFollowGap(ctx, f, currentTXID, currentTXID+1, pageSize)
		if err != nil {
			return currentTXID, err
		}
		currentTXID = bridgedTXID
	}

	return currentTXID, nil
}

// applyLTXFile applies a single LTX file's pages to the database file.
// This follows the same pattern as Hydrator.ApplyLTX (vfs.go:712-747).

View on GitHub (pinned to 4ed7a308f6)

Solutions

  1. Check replica backend listing health
  2. Follow mode retries automatically; fix the underlying backend error
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at replica.go:921 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/5a3772213858b8d5. Report an issue: GitHub.