{"record":{"id":"19393ab7c994ddcb","repo":"nautechsystems/nautilus_trader","slug":"snapshot-from-rpc-cannot-be-combined-with-rese","errorCode":null,"errorMessage":"--snapshot-from-rpc cannot be combined with --reset","messagePattern":"--snapshot-from-rpc cannot be combined with --reset","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/blockchain/analyze.rs","lineNumber":410,"sourceCode":"        }\n    } else {\n        data_client\n            .bootstrap_latest_pool_profiler(pool, Some(checkpoint))\n            .await\n    }\n}\n\nfn validate_snapshot_from_rpc_options(\n    from_block: Option<u64>,\n    reset: bool,\n    require_existing_snapshot: bool,\n) -> anyhow::Result<()> {\n    if from_block.is_some() {\n        anyhow::bail!(\"--snapshot-from-rpc cannot be combined with --from-block\");\n    }\n\n    if reset {\n        anyhow::bail!(\"--snapshot-from-rpc cannot be combined with --reset\");\n    }\n\n    if require_existing_snapshot {\n        anyhow::bail!(\"--snapshot-from-rpc cannot be combined with --require-existing-snapshot\");\n    }\n\n    Ok(())\n}\n\n/// Sorts, dedups, and clamps requested checkpoint blocks to `to_block`.\n///\n/// Checkpoints above `to_block` are dropped; they cannot be snapshotted in this pass.\nfn normalize_checkpoints(checkpoint_blocks: &[u64], to_block: u64) -> Vec<u64> {\n    let mut checkpoints: Vec<u64> = checkpoint_blocks\n        .iter()\n        .copied()\n        .filter(|&block| block <= to_block)\n        .collect();","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/cli/src/blockchain/analyze.rs#L392-L428","documentation":"--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.","triggerScenarios":"Passing both --snapshot-from-rpc and --reset to pool analysis; scripted maintenance commands that always include --reset.","commonSituations":"Users trying to 'refresh' a bad snapshot; cron jobs with a fixed flag set that gained --snapshot-from-rpc.","solutions":["Drop --reset when using --snapshot-from-rpc","If you truly need a clean slate plus RPC-derived snapshot, delete/reset separately first, then run with --snapshot-from-rpc alone","Keep the two modes in separate script branches"],"exampleFix":"// before\nnautilus blockchain analyze --pool 0x.. --snapshot-from-rpc --reset\n// after\nnautilus blockchain analyze --pool 0x.. --snapshot-from-rpc","handlingStrategy":"validation","validationCode":"def check_snapshot_flags(args):\n    if args.snapshot_from_rpc and args.reset:\n        raise ValueError(\"--snapshot-from-rpc cannot be combined with --reset\")","typeGuard":null,"tryCatchPattern":"try:\n    run_analyze(args)\nexcept ValueError as e:\n    if \"cannot be combined\" in str(e):\n        args.reset = False  # or drop snapshot_from_rpc","preventionTips":["Never put --reset in shared flag presets used by RPC-snapshot runs","Run reset as a separate, explicit step","Centralize flag validation in your automation before invoking the CLI"],"tags":["cli","blockchain","flags","conflict"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}