{"record":{"id":"4b4974fe04aee6bb","repo":"rqlite/rqlite","slug":"list-snapshots-s","errorCode":null,"errorMessage":"list snapshots: %s","messagePattern":"list snapshots: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"store/store.go","lineNumber":609,"sourceCode":"\t}\n\tif err := snapshot.Upgrade8To10(old8SnapshotDir, s.snapshotDir, s.logger); err != nil {\n\t\treturn fmt.Errorf(\"failed to upgrade v8 snapshots: %s\", err)\n\t}\n\n\t// Create store for the Snapshots.\n\tsnapshotStore, err := snapshot.NewStore(s.snapshotDir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create snapshot store: %s\", err)\n\t}\n\tsnapshotStore.SetNoVerifyDB(s.NoVerifyDB)\n\tsnapshotStore.LogReaping = s.hcLogLevel() < hclog.Warn\n\tif s.SnapshotReapThreshold > 0 {\n\t\tsnapshotStore.SetReapThreshold(s.SnapshotReapThreshold)\n\t}\n\ts.snapshotStore = snapshotStore\n\tsnaps, err := s.snapshotStore.List()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"list snapshots: %s\", err)\n\t}\n\ts.logger.Printf(\"%d preexisting snapshots present\", len(snaps))\n\n\t// Now, check if the most recent snapshot operation ran to completion\n\t// without error and also check if the underlying DB file is unchanged since\n\t// that snapshot. It shouldn't be changed -- that would require manual\n\t// intervention which would potentially break rqlite -- but protect against\n\t// it anyway. This could also happen in certain downgrade-then-upgrade-again\n\t// scenarios. Anyway if it all looks good we can skip restoring the SQLite\n\t// database from the Raft snapshot store because the contents are logically\n\t// the same.\n\tremoveDBFiles := true\n\tif err := func() error {\n\t\tif snapshotStore.Len() == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\tdefer func() {","sourceCodeStart":591,"sourceCodeEnd":627,"githubUrl":"https://github.com/rqlite/rqlite/blob/7586a4d1bdbd9a5a80021664c5a863cd850adb60/store/store.go#L591-L627","documentation":"During store.Open, rqlite lists pre-existing Raft snapshots via the snapshot store. If that List call fails, the open is aborted and the underlying error is wrapped as \"list snapshots: %s\". This means the node's snapshot directory could not be read, so previously persisted state cannot be validated before Raft starts.","triggerScenarios":"s.snapshotStore.List() returns an error during Open — typically because the snapshots directory is unreadable, a snapshot file is corrupt or has bad permissions, or disk I/O fails.","commonSituations":"Restoring a data directory from a backup with wrong ownership/permissions; truncated snapshot files after a crash or full disk; running rqlited as a different user than the one that created the node directory.","solutions":["Check permissions on the node's data directory and its snapshots/ subdirectory (readable/writable by the rqlited user).","Inspect the wrapped error in the log; if a specific snapshot file is corrupt, remove that snapshot file (keep the most recent valid one and the Raft log) and restart.","Verify disk health and free space with df / dmesg.","As a last resort, restore the node from a fresh backup or rejoin it to the cluster (delete the data dir and start with -join)."],"exampleFix":"// before\n$ ls -ld /data/node/snapshots\ndrwx------ root root /data/node/snapshots\n// after\n$ chown -R rqlite:rqlite /data/node\n$ systemctl restart rqlited","handlingStrategy":"validation","validationCode":"// before starting rqlited\nconst dataDir = \"/data/node\"\nif err := os.MkdirAll(filepath.Join(dataDir, \"snapshots\"), 0o755); err != nil {\n    return err\n}\nif entries, err := os.ReadDir(filepath.Join(dataDir, \"snapshots\")); err != nil {\n    return fmt.Errorf(\"snapshot dir unreadable: %w\", err)\n} else {\n    _ = entries\n}","typeGuard":null,"tryCatchPattern":"// supervisor: alert and restart only after fixing fs access\nif strings.HasPrefix(err.Error(), \"list snapshots:\") {\n    log.Fatalf(\"snapshot dir unusable, halting restarts: %v\", err)\n}","preventionTips":["Run rqlited under a dedicated user with consistent ownership of the data dir","Never chmod/chown the node directory while rqlited is running","Monitor disk health and free space","Copy backups, never the live data directory"],"tags":["raft","snapshot","filesystem","startup"],"backgroundTag":"snapshot-store-list-failed","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"}