tursodatabase/turso · error

MVCC logical pull offset is not a transaction boundary

Error message

MVCC logical pull offset is not a transaction boundary: {offset}

What it means

The MVCC logical-log snapshot records CRC seeds only at transaction boundaries (commits). crc_seed_at was asked for an offset that is not in that boundary list, so the client tried to resume from a byte position in the middle of a transaction's frames, where no consistent resume point exists.

Solutions

  1. Only resume from revision strings the server returned in previous pull responses
  2. If no known-good boundary remains, re-bootstrap with a full pull from offset 0
  3. Never derive offsets by arithmetic on log sizes or response lengths

Example fix

// before
let offset = last_response_body_len + prev_offset; // invented offset
req.client_revision = format!("g1:o{offset}");

// after
req.client_revision = server_returned_revision; // e.g. "g1:o4096" echoed back
Defensive patterns

Strategy: fallback

Try / catch

match pull_logical(stored_revision).await {
    Ok(resp) => resp,
    Err(e) if e.to_string().contains("not a transaction boundary") => {
        bootstrap_full_snapshot().await?; // or pull from offset "g1:o0"
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Client resumes a logical pull with an offset it computed itself (e.g. byte-count arithmetic on previous responses) instead of a server-returned revision; or an offset from a different log generation whose boundary layout differs.

Common situations: Custom sync clients storing raw byte offsets rather than echoing the server's revision string; the .db-log rewritten between pulls so old boundaries no longer line up.

Related errors


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

Appendix: source

Thrown at cli/sync_server.rs:1006

struct HttpResponse {
    status: u16,
    content_type: String,
    body: Vec<u8>,
}

struct MvccLogSnapshot {
    end_offset: u64,
    crc_by_offset: Vec<(u64, u32)>,
}

impl MvccLogSnapshot {
    fn crc_seed_at(&self, offset: u64) -> Result<u32> {
        self.crc_by_offset
            .iter()
            .find_map(|(boundary, crc)| (*boundary == offset).then_some(*crc))
            .ok_or_else(|| {
                anyhow!("MVCC logical pull offset is not a transaction boundary: {offset}")
            })
    }
}

fn logical_log_path(db_path: &str) -> Result<PathBuf> {
    Ok(db_file_path(db_path)?.with_extension("db-log"))
}

fn is_in_memory_db_path(db_path: &str) -> bool {
    db_path == ":memory:"
}

fn db_file_path(db_path: &str) -> Result<PathBuf> {
    if is_in_memory_db_path(db_path) {
        return Err(anyhow!(
            "MVCC logical pull is not supported for in-memory sync server databases"
        ));
    }

View on GitHub (pinned to 492c4a71cd)