{"record":{"id":"0192e9f3bb0d0d84","repo":"benbjohnson/litestream","slug":"sync-restore-output-dir-w","errorCode":null,"errorMessage":"sync restore output dir: %w","messagePattern":"sync restore output dir: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"replica.go","lineNumber":767,"sourceCode":"\n\tdec := ltx.NewDecoder(pr)\n\tif err := dec.DecodeDatabaseTo(f); err != nil {\n\t\treturn fmt.Errorf(\"decode database: %w\", err)\n\t}\n\n\tif err := f.Sync(); err != nil {\n\t\treturn err\n\t} else if err := f.Close(); err != nil {\n\t\treturn err\n\t}\n\n\t// Copy file to final location.\n\tr.Logger().Debug(\"renaming database from temporary location\")\n\tif err := os.Rename(tmpOutputPath, opt.OutputPath); err != nil {\n\t\treturn err\n\t}\n\tif err := internal.FsyncDir(filepath.Dir(opt.OutputPath)); err != nil {\n\t\treturn fmt.Errorf(\"sync restore output dir: %w\", err)\n\t}\n\n\tif opt.IntegrityCheck != IntegrityCheckNone {\n\t\tif err := checkIntegrity(ctx, opt.OutputPath, opt.IntegrityCheck); err != nil {\n\t\t\tif ctx.Err() == nil {\n\t\t\t\t_ = os.Remove(opt.OutputPath)\n\t\t\t\t_ = os.Remove(opt.OutputPath + \"-shm\")\n\t\t\t\t_ = os.Remove(opt.OutputPath + \"-wal\")\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"post-restore integrity check: %w\", err)\n\t\t}\n\t\tr.Logger().Info(\"post-restore integrity check passed\")\n\t}\n\n\t// Enter follow mode if enabled, continuously applying new LTX files.\n\tif opt.Follow {\n\t\tfor _, rd := range rdrs {\n\t\t\tif closer, ok := rd.(io.Closer); ok {","sourceCodeStart":749,"sourceCodeEnd":785,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/replica.go#L749-L785","documentation":"After renaming the restored database into place, FsyncDir on the output directory failed. The rename itself succeeded but durability of the directory entry could not be guaranteed — usually an I/O error or a filesystem that doesn't support fsync on directories.","triggerScenarios":"Thrown at replica.go:767 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check filesystem health and dmesg for I/O errors","Verify the output directory is on a local POSIX filesystem"],"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"}