nautechsystems/nautilus_trader · error · anyhow::Error

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

Error message

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

What it means

--snapshot-from-rpc builds the pool snapshot from live RPC state, so a historical --from-block replay start is meaningless and contradictory. validate_snapshot_from_rpc_options rejects the combination up front.

Source

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

        } else {
            data_client
                .bootstrap_pool_profiler_from_rpc_snapshot(pool, checkpoint)
                .await
        }
    } 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

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Remove --from-block when using --snapshot-from-rpc
  2. Remove --snapshot-from-rpc if you intend a replay from a historical block
  3. Update wrapper scripts to pass the two modes conditionally

Example fix

// before
nautilus blockchain analyze --pool 0x.. --snapshot-from-rpc --from-block 100000
// 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.from_block is not None:
        raise ValueError("--snapshot-from-rpc cannot be combined with --from-block")

Try / catch

try:
    run_analyze(args)
except ValueError as e:
    if "cannot be combined" in str(e):
        fix_flag_conflicts(args)

Prevention

When it happens

Trigger: Running analyze_pool_with_client with both --snapshot-from-rpc and --from-block set; a scripted invocation that always passes --from-block and was extended with --snapshot-from-rpc.

Common situations: Wrappers/shell scripts that hardcode --from-block; users assuming snapshot-from-rpc needs a start block like the replay path does.

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/faf28ee99029790b. Report an issue: GitHub.