{"record":{"id":"842cb2d6f5c17232","repo":"nautechsystems/nautilus_trader","slug":"all-checkpoint-blocks-exceed-to-block-to-bloc","errorCode":null,"errorMessage":"All --checkpoint-blocks exceed --to-block {to_block}","messagePattern":"All --checkpoint-blocks exceed --to-block (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/blockchain/analyze.rs","lineNumber":277,"sourceCode":"    }\n\n    let pool_address = validate_address(&pool_address)?;\n    let pool_identifier = PoolIdentifier::Address(Ustr::from(&pool_address.to_string()));\n\n    // Load only this pool into the cache rather than the whole DEX pool set (tens of thousands of\n    // pools on large DEXes); sync and profiling below operate on this single pool.\n    data_client\n        .register_dex_exchange_for_pool(dex_type, &pool_identifier)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to register DEX exchange: {e}\"))?;\n\n    let checkpoints = if checkpoint_blocks.is_empty() {\n        vec![to_block]\n    } else {\n        normalize_checkpoints(checkpoint_blocks, to_block)\n    };\n    let Some(first_checkpoint) = checkpoints.first().copied() else {\n        anyhow::bail!(\"All --checkpoint-blocks exceed --to-block {to_block}\");\n    };\n\n    // Bounded-replay mode: a usable snapshot must already exist at or before the first checkpoint,\n    // otherwise the caller wants needs_bootstrap rather than a full creation-to-target bootstrap.\n    if require_existing_snapshot\n        && needs_bootstrap_before_target(data_client, &pool_identifier, first_checkpoint).await?\n    {\n        return Ok(vec![PoolAnalysisOutcome::NeedsBootstrap(\n            PoolNeedsBootstrapOutcome {\n                pool_address: pool_address.to_string(),\n                target_block: first_checkpoint,\n            },\n        )]);\n    }\n\n    let last_checkpoint = checkpoints.last().copied().unwrap_or(first_checkpoint);\n\n    if !snapshot_from_rpc {","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/cli/src/blockchain/analyze.rs#L259-L295","documentation":"analyze_pool_with_client normalizes the requested --checkpoint-blocks by clamping them to --to-block. If every requested checkpoint exceeds to_block, the normalized checkpoint list is empty and analysis cannot determine its first replay boundary, so it bails.","triggerScenarios":"Passing --checkpoint-blocks 5000000 with --to-block 4000000; passing only checkpoints above to_block so `checkpoints.first()` is None after normalize_checkpoints clamps/drops them.","commonSituations":"Reusing an old command line after advancing to a lower --to-block; off-by-one when computing to_block as 'latest - N'; copy-pasted checkpoint values from a different chain with higher block numbers.","solutions":["Include the target block itself (or checkpoints <= --to-block) in --checkpoint-blocks","Omit --checkpoint-blocks entirely to default to a checkpoint at --to-block","Raise --to-block if you genuinely need checkpoints above the current target","Verify checkpoint values against the chain's current block height"],"exampleFix":"// before\nnautilus blockchain analyze --to-block 1000000 --checkpoint-blocks 1100000,1200000\n// after\nnautilus blockchain analyze --to-block 1000000 --checkpoint-blocks 500000,1000000","handlingStrategy":"validation","validationCode":"def validate_checkpoints(checkpoints: list[int], to_block: int):\n    if checkpoints and all(c > to_block for c in checkpoints):\n        raise ValueError(\"all --checkpoint-blocks exceed --to-block\")","typeGuard":null,"tryCatchPattern":"try:\n    analyze_pool(client, checkpoints, to_block)\nexcept ValueError as e:\n    print(e)  # adjust checkpoint-blocks or to-block","preventionTips":["Always include a checkpoint at (or below) --to-block, or omit the flag entirely","Clamp checkpoint blocks to to_block in wrapper scripts","Recompute checkpoints when to_block changes; don't reuse stale command lines","Validate checkpoint values against chain height for the target network"],"tags":["cli","blockchain","arguments","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}