tursodatabase/turso · error

invalid MVCC pull revision generation

Error message

invalid MVCC pull revision generation: {revision}

What it means

MVCC pull revisions must have the form g<GENERATION>:o<OFFSET>. parse_mvcc_revision_offset splits on ":o" and requires the left segment to start with 'g'. This variant fires when the generation segment lacks the g prefix, e.g. "1:o5" or "v2:o5".

Solutions

  1. Format revisions strictly as g<N>:o<M> (this server only accepts generation 1)
  2. Echo back the exact revision string the server returned instead of reconstructing it

Example fix

// before
req.client_revision = "1:o8192".to_string();

// after
req.client_revision = "g1:o8192".to_string();
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}', expected g<gen>:o<offset>`);
}

Type guard

function isMvccRevision(s: string): s is string {
    return /^g\d+:o\d+$/.test(s);
}

Prevention

When it happens

Trigger: A client sends client_revision = "1:o128" (missing g) to POST /pull-updates with the MVCC logical stream kind; the split on ":o" succeeds but strip_prefix('g') fails.

Common situations: Hand-building revision strings in test clients; porting client code from a different revision format; typos when composing the string.

Related errors


AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-08-20). Data as JSON: /api/errors/0650f5996071afdc. Report an issue: GitHub.

Appendix: source

Thrown at cli/sync_server.rs:1040

            "MVCC logical pull is not supported for in-memory sync server databases"
        ));
    }
    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> {

View on GitHub (pinned to 492c4a71cd)