{"record":{"id":"3df112085d74137c","repo":"nautechsystems/nautilus_trader","slug":"at-least-one-address-or-addresses-file-entry-i","errorCode":null,"errorMessage":"At least one --address or --addresses-file entry is required","messagePattern":"At least one --address or --addresses-file entry is required","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/blockchain/analyze.rs","lineNumber":593,"sourceCode":"    addresses: Vec<String>,\n    addresses_file: Option<String>,\n) -> anyhow::Result<Vec<String>> {\n    let mut pool_addresses = addresses;\n\n    if let Some(addresses_file) = addresses_file {\n        let contents = fs::read_to_string(&addresses_file)\n            .map_err(|e| anyhow::anyhow!(\"Failed to read addresses file {addresses_file}: {e}\"))?;\n\n        for line in contents.lines() {\n            let trimmed = line.trim();\n            if !trimmed.is_empty() && !trimmed.starts_with('#') {\n                pool_addresses.push(trimmed.to_string());\n            }\n        }\n    }\n\n    if pool_addresses.is_empty() {\n        anyhow::bail!(\"At least one --address or --addresses-file entry is required\");\n    }\n\n    Ok(pool_addresses)\n}\n\n#[derive(Debug)]\nenum PoolAnalysisOutcome {\n    Success(PoolAnalysisSuccessOutcome),\n    NeedsBootstrap(PoolNeedsBootstrapOutcome),\n}\n\n#[derive(Debug)]\nstruct PoolAnalysisSuccessOutcome {\n    pool_address: String,\n    target_block: u64,\n    snapshot_block_position: BlockPosition,\n    positions: usize,\n    ticks: usize,","sourceCodeStart":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/cli/src/blockchain/analyze.rs#L575-L611","documentation":"`load_pool_addresses` in the blockchain analyze CLI aggregates addresses passed via `--address` (repeatable) and entries in `--addresses-file`. If after merging both sources no address remains, it bails with this anyhow error, because pool analysis needs at least one target address. It is a deliberate fail-fast guard against running an analysis over an empty input set.","triggerScenarios":"Running `blockchain analyze-pools` without `--address` and without `--addresses-file`; providing an addresses file that exists but is empty or contains only blank lines/comments; passing flags with values that are all whitespace after trimming.","commonSituations":"Forgot to paste the address argument; a script passes an env var that is unset, so the file path/entries are empty; CI config points at a placeholder empty file; wrong flag spelling so neither address source is populated.","solutions":["Pass at least one address with `--address 0x...` (repeat the flag for multiple pools)","Create/populate the addresses file (one address per line) and pass it via `--addresses-file <path>`","Check that the file is non-empty and lines are not blank/comment-only","Verify shell quoting/expansion so flags actually reach the CLI (e.g. `$ADDRESSES` not unset)"],"exampleFix":"// before\nmycli blockchain analyze-pools --chain ethereum\n// after\nmycli blockchain analyze-pools --chain ethereum --address 0xdAC17F958D2ee523a2206206994597C13D831ec7","handlingStrategy":"validation","validationCode":"if addresses.is_empty() && addresses_file_entries.is_empty() {\n    eprintln!(\"Provide --address or --addresses-file with at least one entry\");\n    std::process::exit(2);\n}","typeGuard":"fn has_addresses(cli: &[String], file_entries: &[String]) -> bool {\n    !cli.is_empty() || !file_entries.is_empty()\n}","tryCatchPattern":null,"preventionTips":["Always pass --address or a populated --addresses-file","Validate the addresses file is non-empty before running","In scripts, fail fast when address env vars are unset"],"tags":["cli","validation","empty-input"],"backgroundTag":"missing-required-argument","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"}