nautechsystems/nautilus_trader · error · anyhow::Error

--snapshot-from-rpc cannot be combined with --require-existi

Error message

--snapshot-from-rpc cannot be combined with --require-existing-snapshot

What it means

--require-existing-snapshot mandates that a stored snapshot already exists (bounded replay, no bootstrap), which is incompatible with --snapshot-from-rpc, whose purpose is to create a snapshot from RPC. validate_snapshot_from_rpc_options rejects the combination.

Source

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

            .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();
    checkpoints.sort_unstable();
    checkpoints.dedup();
    checkpoints
}

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Remove --require-existing-snapshot when building the snapshot from RPC
  2. Remove --snapshot-from-rpc and supply a proper replay range if you want the require-existing (bounded replay) mode
  3. Ensure a snapshot already exists in storage if you intend bounded-replay mode

Example fix

// before
nautilus blockchain analyze --pool 0x.. --snapshot-from-rpc --require-existing-snapshot
// after
nautilus blockchain analyze --pool 0x.. --require-existing-snapshot  # snapshot must already exist
Defensive patterns

Strategy: validation

Validate before calling

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

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: Passing both --snapshot-from-rpc and --require-existing-snapshot to analyze_pool_with_client.

Common situations: Users combining a strict-replay workflow flag set with the RPC-snapshot workflow; docs/examples merged incorrectly.

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