tursodatabase/turso · error

invalid MVCC pull revision offset

Error message

invalid MVCC pull revision offset: {revision}: {err}

What it means

The offset segment of an MVCC revision (the part after ":o") does not parse as u64 — for example "g1:ozero" or "g1:o-5". The parse error text is appended, showing exactly where parsing failed.

Solutions

  1. Emit the offset as a plain base-10 u64: format!("g1:o{}", offset)
  2. Validate with ^g\d+:o\d+$ before sending
  3. Echo the server-provided revision string instead of rebuilding it

Example fix

// before
req.client_revision = format!("g1:o{:#x}", offset);

// after
req.client_revision = format!("g1:o{}", offset);
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}': offset must be a plain base-10 integer`);
}

Type guard

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

Prevention

When it happens

Trigger: A client sends a revision like "g1:o0x1000" (hex), "g1:o-1" (negative), or "g1:o" (empty offset) to a logical pull request.

Common situations: Formatting offsets as hex or with separators; empty offset from a split/format bug; unit confusion (frames vs bytes) producing decorated numbers.

Related errors


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

Appendix: source

Thrown at cli/sync_server.rs:1050

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 {
            end_offset: 0,
            crc_by_offset: vec![(0, 0)],
        });
    }
    if log.len() < MVCC_LOG_HEADER_SIZE {
        return Err(anyhow!(
            "truncated MVCC logical log header: len={} header_size={}",
            log.len(),

View on GitHub (pinned to 492c4a71cd)