{"record":{"id":"f731459427f8d0df","repo":"rqlite/rqlite","slug":"writing-reap-plan-w","errorCode":null,"errorMessage":"writing reap plan: %w","messagePattern":"writing reap plan: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"snapshot/store.go","lineNumber":651,"sourceCode":"\t\t\treturn 0, 0, fmt.Errorf(\"marshaling consolidated meta: %w\", err)\n\t\t}\n\t\tp.AddWriteMeta(full.path, metaJSON)\n\n\t\t// 6. Run an integrity check of the checkpointed database.\n\t\tif s.noVerifyDB.IsNot() {\n\t\t\tp.AddVerifyDB(dbPath)\n\t\t}\n\n\t\t// 7. Rename to new snapshot name. The end result of the Reaping process\n\t\t// will be a new full snapshot with a new ID. That ID is generated from\n\t\t// the newest snapshot's index and term, and the current timestamp.\n\t\tfinalDir := filepath.Join(s.dir, newID)\n\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}","sourceCodeStart":633,"sourceCodeEnd":669,"githubUrl":"https://github.com/rqlite/rqlite/blob/7586a4d1bdbd9a5a80021664c5a863cd850adb60/snapshot/store.go#L633-L669","documentation":"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.","triggerScenarios":"Thrown at snapshot/store.go:651 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check disk space and write permissions in the snapshot store directory","Inspect filesystem health; plan writes are small so failures suggest serious I/O issues","Retry the reap after resolving the I/O problem"],"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"}