nautechsystems/nautilus_trader · error
Invalid chain name: {chain}
Error message
Invalid chain name: {chain} What it means
`parse_chain_dex` converts CLI strings into `Chain` and `DexType` values. If `Chain::from_chain_name` cannot map the provided `--chain` value to a known chain, this error is raised before any client is built.
Source
Thrown at crates/cli/src/blockchain/analyze.rs:504
let config = BlockchainDataClientConfig::builder()
.chain(Arc::new(chain.clone()))
.dex_ids(vec![dex_type])
.http_rpc_url(rpc_http_url.into())
.maybe_multicall_calls_per_rpc_request(multicall_calls_per_rpc_request)
.use_hypersync_for_live_data(true)
.postgres_cache_database_config(postgres_connect_options)
.build();
let cancellation_token = tokio_util::sync::CancellationToken::new();
let mut data_client = BlockchainDataClientCore::new(config, None, None, cancellation_token);
data_client.initialize_cache_database().await;
data_client.cache.initialize_chain().await;
Ok(data_client)
}
fn parse_chain_dex(chain: &str, dex: &str) -> anyhow::Result<(Chain, DexType)> {
let chain = Chain::from_chain_name(chain)
.ok_or_else(|| anyhow::anyhow!("Invalid chain name: {chain}"))?;
let dex_type = find_dex_type_case_insensitive(dex, chain).ok_or_else(|| {
let supported_dexes = get_supported_dexes_for_chain(chain.name);
if supported_dexes.is_empty() {
anyhow::anyhow!(
"Invalid DEX name '{}' (case-insensitive). Chain '{}' is not supported for pool analysis.",
dex, chain.name
)
} else {
anyhow::anyhow!(
"Invalid DEX name '{}' (case-insensitive). Supported DEXes for chain '{}': {}",
dex,
chain.name,
supported_dexes.join(", ")
)
}
})?;
View on GitHub (pinned to 18893faf8b)
Solutions
- Use an exact supported chain name (see the chain registry/docs, e.g. `ethereum`, `base`, `arbitrum`).
- Check spelling and casing against `Chain::from_chain_name` accepted values.
- Upgrade the binary if the chain was added in a newer release.
- Add a mapping for the custom chain if building from source.
Example fix
// before nautilus blockchain analyze-pool --chain eth ... // after nautilus blockchain analyze-pool --chain ethereum ...
Defensive patterns
Strategy: validation
Validate before calling
let supported: Vec<&str> = /* chain registry names */;
if !supported.contains(&chain) {
eprintln!("unsupported chain '{chain}'; choose from: {supported:?}");
std::process::exit(2);
} Prevention
- Validate CLI inputs against the chain registry before building clients.
- Keep the binary up to date with newly supported chains.
- List supported chains in --help output.
When it happens
Trigger: Invoking `nautilus blockchain analyze-pool`/`analyze-pools` with an unrecognized `--chain` string — misspelling, unsupported network, wrong casing not handled, or a chain added in a newer version than the installed binary.
Common situations: Typing `--chain eth` instead of a supported name, using a testnet/custom chain not in the registry, running an outdated nautilus binary that lacks a newly added chain.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- All --checkpoint-blocks exceed --to-block {to_block}
- Invalid venue {}, expected Blockchain DEX format
- `router_addresses` must contain at least one router address
- Quote spend limit for {token_in} -> {token_out} is denominat
- Wrap amount must be positive
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/5129293e20cf646a.
Report an issue: GitHub.