{"record":{"id":"da5cb1861648c583","repo":"benbjohnson/litestream","slug":"checkpoint-w-da5cb1","errorCode":null,"errorMessage":"checkpoint: %w","messagePattern":"checkpoint: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"db.go","lineNumber":1320,"sourceCode":"\t}\n\texec.applySyncResult(result)\n\n\t// Track that data was synced for time-based checkpoint decisions.\n\tif result.synced {\n\t\texec.state.syncedSinceCheckpoint = true\n\t}\n\n\t// Checkpoint checks normally wait until the WAL is fully synced, but the\n\t// emergency truncate threshold must be honored even mid catch-up:\n\t// sustained writes could otherwise keep every chunk limited and defer the\n\t// truncate checkpoint indefinitely, growing the WAL without bound.\n\tif !result.limited || result.syncedToWALEnd || db.exceedsTruncateThreshold(result.origWALSize) {\n\t\tdb.setSyncDiagPhase(diagPhaseCheckpointIfNeeded, func(s *diagState) {\n\t\t\ts.txID = exec.pos.TXID\n\t\t\ts.lastSyncedWALOffset = exec.state.lastSyncedWALOffset\n\t\t})\n\t\tif err := db.checkpointIfNeeded(ctx, exec, result.origWALSize, result.newWALSize); err != nil {\n\t\t\treturn result, fmt.Errorf(\"checkpoint: %w\", err)\n\t\t}\n\t}\n\n\tdb.setSyncDiagPhase(diagPhaseUpdateMetrics, func(s *diagState) {\n\t\ts.txID = exec.pos.TXID\n\t\ts.lastSyncedWALOffset = exec.state.lastSyncedWALOffset\n\t})\n\n\t// Compute current index and total shadow WAL size.\n\tdb.txIDGauge.Set(float64(exec.pos.TXID))\n\n\t// Update file size metrics.\n\tif fi, err := os.Stat(db.path); err == nil {\n\t\tdb.dbSizeGauge.Set(float64(fi.Size()))\n\t}\n\tdb.walSizeGauge.Set(float64(exec.state.lastSyncedWALOffset))\n\n\treturn result, nil","sourceCodeStart":1302,"sourceCodeEnd":1338,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/db.go#L1302-L1338","documentation":"The WAL checkpoint performed after a sync (checkpointIfNeeded) failed. Checkpointing truncates the WAL after it is fully replicated; failure is usually a busy/locked database, a SQLite I/O error, or a poisoned WAL state.","triggerScenarios":"Thrown at db.go:1320 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether another process holds a lock on the database","Verify disk space and file permissions on db/-wal","Inspect the wrapped SQLite error; consider 'litestream reset' if local LTX state is corrupted"],"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"}