{"record":{"id":"635d12d50c817208","repo":"benbjohnson/litestream","slug":"list-level-0-ltx-files-w","errorCode":null,"errorMessage":"list level 0 ltx files: %w","messagePattern":"list level 0 ltx files: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"replica.go","lineNumber":871,"sourceCode":"\t\t\t\t}\n\t\t\t\tr.Logger().Info(\"follow: applied updates\", \"from_txid\", lastTXID, \"to_txid\", newTXID)\n\t\t\t\tlastTXID = newTXID\n\t\t\t\tconsecutiveErrors = 0\n\t\t\t}\n\t\t}\n\t}\n}\n\n// applyNewLTXFiles polls for new LTX files and applies them to the database.\n// It starts from level 0 and falls back to higher levels if there are gaps\n// (e.g., level 0 files were compacted away).\nfunc (r *Replica) applyNewLTXFiles(ctx context.Context, f *os.File, afterTXID ltx.TXID, pageSize uint32) (ltx.TXID, error) {\n\tcurrentTXID := afterTXID\n\n\t// Poll level 0 for the most recent incremental files.\n\titr, err := r.Client.LTXFiles(ctx, 0, currentTXID+1, false)\n\tif err != nil {\n\t\treturn currentTXID, fmt.Errorf(\"list level 0 ltx files: %w\", err)\n\t}\n\tcloseLevel0 := func(retErr error) (ltx.TXID, error) {\n\t\tif closeErr := itr.Close(); closeErr != nil {\n\t\t\tcloseErr = fmt.Errorf(\"close level 0 ltx iterator: %w\", closeErr)\n\t\t\tif retErr != nil {\n\t\t\t\treturn currentTXID, errors.Join(retErr, closeErr)\n\t\t\t}\n\t\t\treturn currentTXID, closeErr\n\t\t}\n\t\treturn currentTXID, retErr\n\t}\n\n\tvar sawLevel0 bool\n\tfor itr.Next() {\n\t\tsawLevel0 = true\n\t\tinfo := itr.Item()\n\n\t\t// If there's a gap, try to fill it from higher compaction levels.","sourceCodeStart":853,"sourceCodeEnd":889,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/replica.go#L853-L889","documentation":"applyNewLTXFiles failed to obtain the level-0 LTX file listing from the replica (LTXFiles). Backend list error — connectivity, credentials, or bucket state — prevents the follow loop from seeing new transactions.","triggerScenarios":"Thrown at replica.go:871 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check replica backend connectivity and credentials","The follow loop tolerates repeated errors (logged with consecutive_errors) and keeps polling; fix the backend to resume applying"],"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"}