{"record":{"id":"688d3fcc848796cb","repo":"benbjohnson/litestream","slug":"decode-database-w","errorCode":null,"errorMessage":"decode database: %w","messagePattern":"decode database: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"replica.go","lineNumber":752,"sourceCode":"\t\treturn fmt.Errorf(\"create temp database path: %w\", err)\n\t}\n\tdefer func() { _ = f.Close() }()\n\n\tpr, pw := io.Pipe()\n\n\tgo func() {\n\t\tc, err := ltx.NewCompactor(pw, rdrs)\n\t\tif err != nil {\n\t\t\tpw.CloseWithError(fmt.Errorf(\"new ltx compactor: %w\", err))\n\t\t\treturn\n\t\t}\n\t\tc.HeaderFlags = ltx.HeaderFlagNoChecksum\n\t\t_ = pw.CloseWithError(c.Compact(ctx))\n\t}()\n\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 {","sourceCodeStart":734,"sourceCodeEnd":770,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/replica.go#L734-L770","documentation":"The LTX decoder failed while writing the compacted database image to the temp file. Either a streamed LTX file was corrupt/truncated (checksum or framing error from the compactor goroutine) or the local disk write failed.","triggerScenarios":"Thrown at replica.go:752 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check disk space and permissions at the output location","Inspect the wrapped error: checksum errors indicate replica-side corruption; retry after removing the bad LTX file"],"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"}