{"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":699,"sourceCode":"        };\n        let snapshot = match scan_mvcc_log(&log) {\n            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                    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)?;","sourceCodeStart":681,"sourceCodeEnd":717,"githubUrl":"https://github.com/tursodatabase/turso/blob/bad083fafbefdeae9a42ec19bdaaad8918dcf411/cli/sync_server.rs#L681-L717","documentation":"For MVCC logical pulls the server scans its on-disk .db-log and computes end_offset, the end of the last complete transaction. The client_revision (format g1:o<offset>) must parse to an offset <= end_offset; a larger offset means the client has seen a longer logical log than this server holds, so no incremental range can be served and the request fails with HTTP 500.","triggerScenarios":"A client synced from a different (or newer production) server whose persisted revision g1:oN has N greater than this server's end_offset; the server's .db/.db-log recreated or restored from an older snapshot while the client kept its revision.","commonSituations":"Swapping sync endpoints in tests; restoring a server database from backup while reusing client state; running one client against two server instances.","solutions":["Point the client back at the server whose logical log it actually synced from.","Reset the client database (or clear its persisted revision) so it re-bootstraps from offset 0 against this server.","If you control the server, answer future revisions with a ReplaceBase page response instead of a 500."],"exampleFix":"// before: revision persisted from another server\nreq.client_revision = \"g1:o9500\".to_string();\n\n// after: fresh bootstrap; server replies with its current revision\nreq.client_revision = String::new();","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"On 500 containing 'revision is from the future', discard the persisted revision, re-bootstrap the local database, and pull once with an empty client_revision; retrying the same revision will always fail.","preventionTips":["Persist and reuse only server-provided revision strings.","Never point one client at two different sync servers.","After restoring a server database from backup, reset attached clients' sync state."],"tags":["mvcc","sync","revision","logical-log","replication"],"backgroundTag":"client-server-revision-mismatch","analyzedSha":"bad083fafbefdeae9a42ec19bdaaad8918dcf411","analyzedAt":"2026-08-16T23:12:11.798Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}