nautechsystems/nautilus_trader · error · anyhow::Error
Failed to read addresses file {addresses_file}: {e}
Error message
Failed to read addresses file {addresses_file}: {e} What it means
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.
Source
Thrown at crates/cli/src/blockchain/analyze.rs:582
})
}
async fn resolve_to_block(data_client: &BlockchainDataClientCore, to_block: Option<u64>) -> u64 {
match to_block {
Some(block) => block,
None => data_client.hypersync_client.current_block().await,
}
}
fn load_pool_addresses(
addresses: Vec<String>,
addresses_file: Option<String>,
) -> anyhow::Result<Vec<String>> {
let mut pool_addresses = addresses;
if let Some(addresses_file) = addresses_file {
let contents = fs::read_to_string(&addresses_file)
.map_err(|e| anyhow::anyhow!("Failed to read addresses file {addresses_file}: {e}"))?;
for line in contents.lines() {
let trimmed = line.trim();
if !trimmed.is_empty() && !trimmed.starts_with('#') {
pool_addresses.push(trimmed.to_string());
}
}
}
if pool_addresses.is_empty() {
anyhow::bail!("At least one --address or --addresses-file entry is required");
}
Ok(pool_addresses)
}
#[derive(Debug)]
enum PoolAnalysisOutcome {View on GitHub (pinned to 18893faf8b)
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.
Example fix
// before nautilusctl blockchain analyze-pools --addresses-file ./adressess.txt // after nautilusctl blockchain analyze-pools --addresses-file ./addresses.txt
Defensive patterns
Strategy: validation
Validate before calling
let path = std::path::Path::new(addresses_file);
if !path.is_file() {
eprintln!("addresses file not found or not a file: {}", addresses_file);
std::process::exit(2);
} Try / catch
match load_pool_addresses(addresses, Some(file)) {
Ok(addrs) => addrs,
Err(e) => { eprintln!("{e:#}"); std::process::exit(2); } // includes path + io error cause
} Prevention
- 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).
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Failed to reset file position for '{}' after {MAX_RETRIES} a
- Pool analysis failed for {failures} pool(s)
- All --checkpoint-blocks exceed --to-block {to_block}
- --snapshot-from-rpc cannot be combined with --from-block
- --snapshot-from-rpc cannot be combined with --reset
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/339ba356e11ccaf0.
Report an issue: GitHub.