{"record":{"id":"d7034c7a4dfb50b8","repo":"nautechsystems/nautilus_trader","slug":"snapshot-from-rpc-cannot-be-combined-with-requ","errorCode":null,"errorMessage":"--snapshot-from-rpc cannot be combined with --require-existing-snapshot","messagePattern":"--snapshot-from-rpc cannot be combined with --require-existing-snapshot","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/blockchain/analyze.rs","lineNumber":414,"sourceCode":"            .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();\n    checkpoints.sort_unstable();\n    checkpoints.dedup();\n    checkpoints\n}","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/cli/src/blockchain/analyze.rs#L396-L432","documentation":"--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.","triggerScenarios":"Passing both --snapshot-from-rpc and --require-existing-snapshot to analyze_pool_with_client.","commonSituations":"Users combining a strict-replay workflow flag set with the RPC-snapshot workflow; docs/examples merged incorrectly.","solutions":["Remove --require-existing-snapshot when building the snapshot from RPC","Remove --snapshot-from-rpc and supply a proper replay range if you want the require-existing (bounded replay) mode","Ensure a snapshot already exists in storage if you intend bounded-replay mode"],"exampleFix":"// before\nnautilus blockchain analyze --pool 0x.. --snapshot-from-rpc --require-existing-snapshot\n// after\nnautilus blockchain analyze --pool 0x.. --require-existing-snapshot  # snapshot must already exist","handlingStrategy":"validation","validationCode":"def check_snapshot_flags(args):\n    if args.snapshot_from_rpc and args.require_existing_snapshot:\n        raise ValueError(\"--snapshot-from-rpc cannot be combined with --require-existing-snapshot\")","typeGuard":null,"tryCatchPattern":"try:\n    run_analyze(args)\nexcept ValueError as e:\n    if \"cannot be combined\" in str(e):\n        fix_flag_conflicts(args)","preventionTips":["Choose one mode per invocation: RPC-snapshot creation OR bounded replay with an existing snapshot","Verify a snapshot exists before adding --require-existing-snapshot","Encode the mode choice as a single enum in automation instead of raw flags"],"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"}