nautechsystems/nautilus_trader · error · anyhow::Error

--snapshot-from-rpc cannot be combined with --reset

Error message

--snapshot-from-rpc cannot be combined with --reset

What it means

--snapshot-from-rpc derives the snapshot from current RPC state, while --reset erases existing stored snapshots. Combining them is contradictory (resetting then rebuilding from RPC vs. reusing state), so validate_snapshot_from_rpc_options rejects it.

Source

Thrown at crates/cli/src/blockchain/analyze.rs:410

        }
    } else {
        data_client
            .bootstrap_latest_pool_profiler(pool, Some(checkpoint))
            .await
    }
}

fn validate_snapshot_from_rpc_options(
    from_block: Option<u64>,
    reset: bool,
    require_existing_snapshot: bool,
) -> anyhow::Result<()> {
    if from_block.is_some() {
        anyhow::bail!("--snapshot-from-rpc cannot be combined with --from-block");
    }

    if reset {
        anyhow::bail!("--snapshot-from-rpc cannot be combined with --reset");
    }

    if require_existing_snapshot {
        anyhow::bail!("--snapshot-from-rpc cannot be combined with --require-existing-snapshot");
    }

    Ok(())
}

/// Sorts, dedups, and clamps requested checkpoint blocks to `to_block`.
///
/// Checkpoints above `to_block` are dropped; they cannot be snapshotted in this pass.
fn normalize_checkpoints(checkpoint_blocks: &[u64], to_block: u64) -> Vec<u64> {
    let mut checkpoints: Vec<u64> = checkpoint_blocks
        .iter()
        .copied()
        .filter(|&block| block <= to_block)
        .collect();

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Drop --reset when using --snapshot-from-rpc
  2. If you truly need a clean slate plus RPC-derived snapshot, delete/reset separately first, then run with --snapshot-from-rpc alone
  3. Keep the two modes in separate script branches

Example fix

// before
nautilus blockchain analyze --pool 0x.. --snapshot-from-rpc --reset
// after
nautilus blockchain analyze --pool 0x.. --snapshot-from-rpc
Defensive patterns

Strategy: validation

Validate before calling

def check_snapshot_flags(args):
    if args.snapshot_from_rpc and args.reset:
        raise ValueError("--snapshot-from-rpc cannot be combined with --reset")

Try / catch

try:
    run_analyze(args)
except ValueError as e:
    if "cannot be combined" in str(e):
        args.reset = False  # or drop snapshot_from_rpc

Prevention

When it happens

Trigger: Passing both --snapshot-from-rpc and --reset to pool analysis; scripted maintenance commands that always include --reset.

Common situations: Users trying to 'refresh' a bad snapshot; cron jobs with a fixed flag set that gained --snapshot-from-rpc.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/19393ab7c994ddcb. Report an issue: GitHub.