{"record":{"id":"0226101bdd0c19ce","repo":"rqlite/rqlite","slug":"executing-reap-plan-w","errorCode":null,"errorMessage":"executing reap plan: %w","messagePattern":"executing reap plan: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"snapshot/store.go","lineNumber":664,"sourceCode":"\t\tp.AddRename(full.path, finalDir)\n\t}\n\n\t// Persist the plan to disk for crash recovery.\n\tif err := plan.WriteToFile(p, s.reapPlanPath); err != nil {\n\t\treturn 0, 0, fmt.Errorf(\"writing reap plan: %w\", err)\n\t}\n\n\treturn s.executeReapPlan(p, s.reapPlanPath)\n}\n\n// executeReapPlan executes a reap plan and cleans up.\nfunc (s *Store) executeReapPlan(p *plan.Plan, planPath string) (int, int, error) {\n\tstartT := time.Now()\n\tdefer recordDuration(reapExecuteDuration, startT)\n\n\texecutor := plan.NewExecutor()\n\tif err := p.Execute(executor); err != nil {\n\t\treturn 0, 0, fmt.Errorf(\"executing reap plan: %w\", err)\n\t}\n\n\tif err := fsutil.SyncDirMaybe(s.dir); err != nil {\n\t\treturn 0, 0, fmt.Errorf(\"syncing store dir: %w\", err)\n\t}\n\n\t// Clean up the plan file.\n\tos.Remove(planPath)\n\treturn p.NReaped, p.NCheckpointed, nil\n}\n\n// signalReap sends a non-blocking signal to the reaper goroutine.\nfunc (s *Store) signalReap() {\n\tselect {\n\tcase s.reapCh <- struct{}{}:\n\tdefault:\n\t}\n}","sourceCodeStart":646,"sourceCodeEnd":682,"githubUrl":"https://github.com/rqlite/rqlite/blob/7586a4d1bdbd9a5a80021664c5a863cd850adb60/snapshot/store.go#L646-L682","documentation":"executeReapPlan ran the persisted plan via plan.Plan.Execute and the executor returned an error mid-plan (wrapped via %w). Because plan operations run in order and stop at the first error, the store may be mid-reap; the plan file remains on disk so the next startup/check resumes it.","triggerScenarios":"Thrown at snapshot/store.go:664 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error to see which plan operation failed (remove/rename/verify)","Resolve the filesystem issue (permissions, missing files, disk full)","Restart or re-check the store; the interrupted plan is resumed automatically"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7586a4d1bdbd9a5a80021664c5a863cd850adb60","analyzedAt":"2026-09-03T07:03:02.260Z","contentChangedAt":"2026-09-03T07:03:02.260Z","schemaVersion":2},"datasetVersion":"2026-09-10T12:17:11.382Z"}