{"record":{"id":"1bc0cd0fe8aecc9e","repo":"tursodatabase/turso","slug":"mvcc-logical-pull-revision-is-from-the-future-cli","errorCode":null,"errorMessage":"MVCC logical pull revision is from the future: client_offset={} server_offset={}","messagePattern":"MVCC logical pull revision is from the future: client_offset=(.+?) server_offset=(.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"cli/sync_server.rs","lineNumber":810,"sourceCode":"            Ok(snapshot) => snapshot,\n            Err(err) if is_nonportable_mvcc_log_error(&err) => {\n                info!(\n                    \"logical pull requested but MVCC log is not portable; returning replace-base pages: {err}\"\n                );\n                return self.handle_logical_fallback(\n                    db,\n                    req,\n                    fallback_revision,\n                    &legacy_current_revision,\n                    db_size,\n                );\n            }\n            Err(err) => return Err(err),\n        };\n        let start_offset = parse_mvcc_revision_offset(&req.client_revision, snapshot.end_offset)?;\n        if start_offset > snapshot.end_offset {\n            return Err(anyhow!(\n                \"MVCC logical pull revision is from the future: client_offset={} server_offset={}\",\n                start_offset,\n                snapshot.end_offset\n            ));\n        }\n        let start = usize::try_from(start_offset)\n            .map_err(|_| anyhow!(\"MVCC logical pull start offset overflows usize\"))?;\n        let end = usize::try_from(snapshot.end_offset)\n            .map_err(|_| anyhow!(\"MVCC logical pull end offset overflows usize\"))?;\n\n        let mut response_body = Vec::new();\n        let (mvcc_log, body) = if start == end {\n            (None, Vec::new())\n        } else {\n            let crc_seed = if start_offset == 0 {\n                None\n            } else {\n                let seed = snapshot.crc_seed_at(start_offset)?;\n                Some(seed.to_le_bytes().to_vec())","sourceCodeStart":792,"sourceCodeEnd":828,"githubUrl":"https://github.com/tursodatabase/turso/blob/492c4a71cd7c2649e7df83da1471b74f4b1c7aa9/cli/sync_server.rs#L792-L828","documentation":"For an MVCC logical pull, the server parses the client revision (format g1:oOFFSET), clamps legacy values to the snapshot end offset, and then rejects any client offset greater than the server's current logical-log end offset. The client claims a position in the log that this server has never written, so no delta can be served.","triggerScenarios":"Client synced from a different server (or an earlier incarnation of this server whose .db-log was longer) and presents a higher offset; the server's database or .db-log was recreated/truncated while client sync state was preserved.","commonSituations":"Test harness restarts the sync server with fresh db/.db-log files but keeps client sync state; pointing an already-synced client at a newly rebuilt server; copying client state between environments.","solutions":["Re-bootstrap the client with a full page snapshot pull so its revision resets to the server's current position","Persist the server's database and .db-log across restarts so offsets stay monotonic","Point the client back at the server instance it actually synced from"],"exampleFix":"// before: keep stale client revision after server reset\nclient.pull_updates(); // -> revision is from the future\n\n// after: detect and re-bootstrap\nif pull_failed_with_future_revision {\n    client.reset_state();\n    client.bootstrap_full_snapshot().await?;\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match pull_logical(client_revision).await {\n    Ok(resp) => resp,\n    Err(e) if e.to_string().contains(\"revision is from the future\") => {\n        bootstrap_full_snapshot().await?;  // reset client revision via page pull\n        pull_logical(None).await           // then resume logical pulls\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Persist the server's db and .db-log across restarts so offsets stay monotonic","Treat server database recreation as a signal to re-bootstrap all clients","Never copy sync state between environments or server instances"],"tags":["mvcc","sync-server","logical-pull","revision-mismatch"],"backgroundTag":"replication-offset-out-of-range","analyzedSha":"492c4a71cd7c2649e7df83da1471b74f4b1c7aa9","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}