{"record":{"id":"339ba356e11ccaf0","repo":"nautechsystems/nautilus_trader","slug":"failed-to-read-addresses-file-addresses-file-e","errorCode":null,"errorMessage":"Failed to read addresses file {addresses_file}: {e}","messagePattern":"Failed to read addresses file (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/blockchain/analyze.rs","lineNumber":582,"sourceCode":"        })\n}\n\nasync fn resolve_to_block(data_client: &BlockchainDataClientCore, to_block: Option<u64>) -> u64 {\n    match to_block {\n        Some(block) => block,\n        None => data_client.hypersync_client.current_block().await,\n    }\n}\n\nfn load_pool_addresses(\n    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 {","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/cli/src/blockchain/analyze.rs#L564-L600","documentation":"Thrown by load_pool_addresses when the optional addresses file supplied via the CLI cannot be read from disk. The std::fs::read_to_string IO error is wrapped with the file path for context before any addresses are parsed.","triggerScenarios":"run_analyze_pools (or the load_pool_addresses tests) called with addresses_file=Some(path) where the file does not exist, is a directory, or the process lacks read permission.","commonSituations":"Typo in the --addresses-file path; running from a different working directory than assumed; passing a directory instead of a file; permission-restricted file in CI; deleted temp file.","solutions":["Verify the path exists and is a regular file: ls -l <path>.","Use an absolute path or run from the directory you assumed.","Fix file permissions (chmod) or run as a user with read access.","Check the wrapped io error in the message (e.g. 'No such file or directory') for the exact cause."],"exampleFix":"// before\nnautilusctl blockchain analyze-pools --addresses-file ./adressess.txt\n// after\nnautilusctl blockchain analyze-pools --addresses-file ./addresses.txt","handlingStrategy":"validation","validationCode":"let path = std::path::Path::new(addresses_file);\nif !path.is_file() {\n    eprintln!(\"addresses file not found or not a file: {}\", addresses_file);\n    std::process::exit(2);\n}","typeGuard":null,"tryCatchPattern":"match load_pool_addresses(addresses, Some(file)) {\n    Ok(addrs) => addrs,\n    Err(e) => { eprintln!(\"{e:#}\"); std::process::exit(2); } // includes path + io error cause\n}","preventionTips":["Verify the file exists with ls/test -f before invoking the command.","Use absolute paths in scripts to avoid cwd assumptions.","Never pass a directory path as the addresses file.","Check file permissions for the user the tool runs as (CI service accounts)."],"tags":["cli","filesystem","io"],"backgroundTag":"file-read-failed","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"}