rqlite/rqlite · error

writing reap plan: %w

Error message

writing reap plan: %w

What it means

Reap step: persisting the crash-recovery plan with plan.WriteToFile failed, wrapped via %w. Without a durable plan the multi-step reap (delete, rename, metadata write) cannot be safely executed, so it aborts before touching snapshots.

Source

Thrown at snapshot/store.go:651

			return 0, 0, fmt.Errorf("marshaling consolidated meta: %w", err)
		}
		p.AddWriteMeta(full.path, metaJSON)

		// 6. Run an integrity check of the checkpointed database.
		if s.noVerifyDB.IsNot() {
			p.AddVerifyDB(dbPath)
		}

		// 7. Rename to new snapshot name. The end result of the Reaping process
		// will be a new full snapshot with a new ID. That ID is generated from
		// the newest snapshot's index and term, and the current timestamp.
		finalDir := filepath.Join(s.dir, newID)
		p.AddRename(full.path, finalDir)
	}

	// Persist the plan to disk for crash recovery.
	if err := plan.WriteToFile(p, s.reapPlanPath); err != nil {
		return 0, 0, fmt.Errorf("writing reap plan: %w", err)
	}

	return s.executeReapPlan(p, s.reapPlanPath)
}

// executeReapPlan executes a reap plan and cleans up.
func (s *Store) executeReapPlan(p *plan.Plan, planPath string) (int, int, error) {
	startT := time.Now()
	defer recordDuration(reapExecuteDuration, startT)

	executor := plan.NewExecutor()
	if err := p.Execute(executor); err != nil {
		return 0, 0, fmt.Errorf("executing reap plan: %w", err)
	}

	if err := fsutil.SyncDirMaybe(s.dir); err != nil {
		return 0, 0, fmt.Errorf("syncing store dir: %w", err)
	}

View on GitHub (pinned to 7586a4d1bd)

Solutions

  1. Check disk space and write permissions in the snapshot store directory
  2. Inspect filesystem health; plan writes are small so failures suggest serious I/O issues
  3. Retry the reap after resolving the I/O problem
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at snapshot/store.go:651 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rqlite/rqlite@7586a4d1bd (2026-09-03). Data as JSON: /api/errors/f731459427f8d0df. Report an issue: GitHub.