{"record":{"id":"e00b4d2798be891f","repo":"rqlite/rqlite","slug":"reading-reap-plan-w","errorCode":null,"errorMessage":"reading reap plan: %w","messagePattern":"reading reap plan: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"snapshot/store.go","lineNumber":535,"sourceCode":"\tstats.Get(reapWALs).(*expvar.Int).Set(int64(c))\n\ts.observers.notify(ReapObservation{\n\t\tSnapshotsReaped: n,\n\t\tWALsReaped:      c,\n\t\tDuration:        time.Since(startTime),\n\t})\n\treturn n, c, nil\n}\n\n// reapInternal performs the actual reap logic. The caller must hold the write lock.\nfunc (s *Store) reapInternal() (int, int, error) {\n\t// If a reap plan file exists, that means a previous reap must have encountered an error.\n\t// Let's make sure it is completed before we start a new reap.\n\tif fsutil.FileExists(s.reapPlanPath) {\n\t\ts.logger.Printf(\"found interrupted reap plan at %s, resuming\", s.reapPlanPath)\n\t\tstats.Add(reapPlanRecovered, 1)\n\t\tp, err := plan.ReadFromFile(s.reapPlanPath)\n\t\tif err != nil {\n\t\t\treturn 0, 0, fmt.Errorf(\"reading reap plan: %w\", err)\n\t\t}\n\t\treturn s.executeReapPlan(p, s.reapPlanPath)\n\t} else {\n\t\t// A reap reads and rewrites the data files, so verify their integrity\n\t\t// first (runs at most once over the Store's lifetime). We only do this if\n\t\t// a reap wasn't previously interrupted (by a crash most likely), as an\n\t\t// interrupted reap leaves data in an undefined state. On corruption this\n\t\t// hard exits in production via fatalFn; with fatalFn disabled (tests) the\n\t\t// error is returned.\n\t\tif err := s.ensureVerified(); err != nil {\n\t\t\treturn 0, 0, err\n\t\t}\n\t}\n\n\t// Scan store.\n\tsnapSet, err := s.getSnapshots()\n\tif err != nil {\n\t\treturn 0, 0, err","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/rqlite/rqlite/blob/7586a4d1bdbd9a5a80021664c5a863cd850adb60/snapshot/store.go#L517-L553","documentation":"reapInternal found an existing reap-plan file (evidence of a previously interrupted reap) and attempted to resume by reading it with plan.ReadFromFile; that read failed, wrapped via %w. The plan file is corrupt or unreadable, blocking recovery of the interrupted reap.","triggerScenarios":"Thrown at snapshot/store.go:535 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the reap plan file for corruption (truncated/partial JSON)","After confirming snapshot integrity, remove the stale plan file so a fresh reap can proceed","Check disk and permission health in the snapshot store directory"],"exampleFix":null,"handlingStrategy":"fallback","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"}