tursodatabase/turso · error
invalid MVCC pull revision generation
Error message
invalid MVCC pull revision generation: {revision}: {err} What it means
The generation segment of an MVCC revision carries the 'g' prefix but does not parse as u64 — for example "gone:o5" or "g1x:o5". The parse error text is appended to the message, pinpointing the bad characters.
Solutions
- Build the revision with a formatter over integers: format!("g{}:o{}", gen, offset)
- Validate the revision against ^g\d+:o\d+$ before sending
- Store server-returned revisions verbatim rather than parsing and reassembling them
Example fix
// before
req.client_revision = format!("g{}x:o{}", gen, off);
// after
req.client_revision = format!("g{}:o{}", gen, off); Defensive patterns
Strategy: type-guard
Validate before calling
const MVCC_REVISION_RE = /^g\d+:o\d+$/;
if (!MVCC_REVISION_RE.test(revision)) {
throw new Error(`invalid MVCC revision '${revision}': generation must be g<plain integer>`);
} Type guard
function isMvccRevision(s: string): s is string {
return /^g\d+:o\d+$/.test(s);
} Prevention
- Never concatenate labels into the generation segment
- Round-trip revisions through integer parse + format before sending
When it happens
Trigger: A client sends a revision like "g2x:o64" where the text after 'g' is not a plain integer; split and prefix checks passed, the u64 parse failed.
Common situations: String concatenation bugs when building revisions (e.g. embedding a label after the generation number); locale or formatting artifacts injected into the string.
Related errors
- invalid MVCC pull revision generation
- invalid MVCC pull revision offset
- sync_server supports only single-generation MVCC logical…
- buffer too short for u32 at offset
- buffer too short for u64 at offset
AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-08-20).
Data as JSON: /api/errors/b281a56db827ced2.
Report an issue: GitHub.
Appendix: source
Thrown at cli/sync_server.rs:1042
}
let path = if let Some(rest) = db_path.strip_prefix("file:") {
rest.split_once('?').map_or(rest, |(path, _)| path)
} else {
db_path
};
Ok(PathBuf::from(path))
}
fn parse_mvcc_revision_offset(revision: &str, legacy_default: u64) -> Result<u64> {
if revision.is_empty() {
return Ok(0);
}
if let Some((generation, offset)) = revision.split_once(":o") {
let generation = generation
.strip_prefix('g')
.ok_or_else(|| anyhow!("invalid MVCC pull revision generation: {revision}"))?
.parse::<u64>()
.map_err(|err| anyhow!("invalid MVCC pull revision generation: {revision}: {err}"))?;
if generation != 1 {
return Err(anyhow!(
"sync_server supports only single-generation MVCC logical pulls: {revision}"
));
}
return offset
.parse::<u64>()
.map_err(|err| anyhow!("invalid MVCC pull revision offset: {revision}: {err}"));
}
// Older page bootstrap responses from this test server used WAL frame
// numbers. Treat them as "the page snapshot already includes the current
// logical log" so the required follow-up logical pull becomes a no-op.
Ok(legacy_default)
}
fn scan_mvcc_log(log: &[u8]) -> Result<MvccLogSnapshot> {
if log.is_empty() {
return Ok(MvccLogSnapshot {View on GitHub (pinned to 492c4a71cd)