{"record":{"id":"3490d7b7ca068a5c","repo":"benbjohnson/litestream","slug":"snapshot-s-w","errorCode":null,"errorMessage":"snapshot %s: %w","messagePattern":"snapshot (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/replicate.go","lineNumber":417,"sourceCode":"\t\tslog.Info(\"syncing database\", \"path\", db.Path())\n\n\t\t// Sync the database to process any pending WAL changes.\n\t\tif err = db.Sync(ctx); err != nil {\n\t\t\terr = fmt.Errorf(\"sync database %s: %w\", db.Path(), err)\n\t\t\treturn\n\t\t}\n\n\t\t// Sync the replica to upload any pending LTX files.\n\t\tif err = db.Replica.Sync(ctx); err != nil {\n\t\t\terr = fmt.Errorf(\"sync replica for %s: %w\", db.Path(), err)\n\t\t\treturn\n\t\t}\n\n\t\t// Force a snapshot if requested.\n\t\tif c.forceSnapshot {\n\t\t\tslog.Info(\"taking snapshot\", \"path\", db.Path())\n\t\t\tif _, err = db.Snapshot(ctx); err != nil {\n\t\t\t\terr = fmt.Errorf(\"snapshot %s: %w\", db.Path(), err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// Enforce retention if requested.\n\t\tif c.enforceRetention {\n\t\t\tslog.Info(\"enforcing retention\", \"path\", db.Path())\n\t\t\tif err = c.Store.EnforceSnapshotRetention(ctx, db); err != nil {\n\t\t\t\terr = fmt.Errorf(\"enforce retention for %s: %w\", db.Path(), err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tslog.Info(\"one-shot replication complete\")\n}\n\n// Close closes all open databases.","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/replicate.go#L399-L435","documentation":"ReplicateCommand.runOnce failed while forcing a snapshot of the database (db.Snapshot) with -force-snapshot. Snapshot creation reads the full database into a level-Snapshot LTX file; failure typically means a read error on the database file or a replica write error.","triggerScenarios":"Thrown at cmd/litestream/replicate.go:417 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check database file readability and disk space","Examine the wrapped error for replica client issues","Retry after resolving the underlying cause"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}