{"record":{"id":"84ebb974f7ba7b7d","repo":"benbjohnson/litestream","slug":"fetch-l0-files-w","errorCode":null,"errorMessage":"fetch l0 files: %w","messagePattern":"fetch l0 files: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compactor.go","lineNumber":370,"sourceCode":"\t}\n\tvar maxL1TXID ltx.TXID\n\tfor itr.Next() {\n\t\tinfo := itr.Item()\n\t\tif info.MaxTXID > maxL1TXID {\n\t\t\tmaxL1TXID = info.MaxTXID\n\t\t}\n\t}\n\tif err := itr.Close(); err != nil {\n\t\treturn fmt.Errorf(\"close l1 iterator: %w\", err)\n\t}\n\tif maxL1TXID == 0 {\n\t\treturn nil\n\t}\n\n\tthreshold := time.Now().Add(-retention)\n\titr, err = c.client.LTXFiles(ctx, 0, 0, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fetch l0 files: %w\", err)\n\t}\n\tdefer itr.Close()\n\n\tvar (\n\t\tdeleted      []*ltx.FileInfo\n\t\tlastInfo     *ltx.FileInfo\n\t\tprocessedAll = true\n\t)\n\tfor itr.Next() {\n\t\tinfo := itr.Item()\n\t\tlastInfo = info\n\n\t\tcreatedAt := info.CreatedAt\n\t\tif createdAt.IsZero() {\n\t\t\tcreatedAt = threshold\n\t\t}\n\n\t\tif createdAt.After(threshold) {","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/compactor.go#L352-L388","documentation":"EnforceL0Retention lists level-0 (L0, transactional) LTX files to find those older than the retention threshold. Failure to open that listing iterator is wrapped as 'fetch l0 files: %w'. No L0 files are deleted when this fails.","triggerScenarios":"c.client.LTXFiles(ctx, 0, 0, false) fails after the L1 watermark check succeeded — storage auth error, endpoint outage, or listing API failure on the level-0 prefix.","commonSituations":"S3/GCS outage; expired session token mid-cycle; bucket path renamed so the l0/ prefix no longer matches; per-prefix IAM scoping missing the transactional file path.","solutions":["Verify credentials have list access to the level-0 path in the replica","Check provider status/endpoint reachability; retry the periodic retention run","Confirm replica path configuration matches where L0 files are written","Inspect the wrapped error's provider code for the precise cause"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Health-check the storage backend before the retention window\nctx, cancel := context.WithTimeout(ctx, 10*time.Second)\ndefer cancel()\n_, err := client.LTXFiles(ctx, 0, 0, false)","typeGuard":null,"tryCatchPattern":"if err := c.EnforceL0Retention(ctx, retention); err != nil {\n    if isTransientStorageError(err) { /* backoff and retry next cycle */ }\n}","preventionTips":["Ensure list permission on the l0 prefix","Monitor storage provider status during retention windows","Keep credentials refreshed (STS/session tokens)"],"tags":["storage","listing","l0-retention","network"],"backgroundTag":"file-list-failed","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}