nautechsystems/nautilus_trader · error
Invalid DEX name '{}' (case-insensitive). Supported DEXes fo
Error message
Invalid DEX name '{}' (case-insensitive). Supported DEXes for chain '{}': {} What it means
Thrown by parse_chain_dex when the --dex argument does not match any DEX registered for the given chain, but the chain itself IS supported for pool analysis. The message enumerates the valid DEX names so the user can pick a correct one.
Source
Thrown at crates/cli/src/blockchain/analyze.rs:514
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(", ")
)
}
})?;
ensure_pool_analysis_supported(chain, dex_type)?;
Ok((chain.to_owned(), dex_type))
}
// A DEX can be registered for discovery yet lack the analysis parsers; fail here instead of
// syncing and only failing deep inside profiling.
fn ensure_pool_analysis_supported(chain: &Chain, dex_type: DexType) -> anyhow::Result<()> {
let dex_extended = get_dex_extended(chain.name, &dex_type).ok_or_else(|| {
anyhow::anyhow!(View on GitHub (pinned to 18893faf8b)
Solutions
- Use one of the DEX names listed in the error message (matching is case-insensitive).
- List supported DEXes programmatically with get_supported_dexes_for_chain(chain.name) before invoking.
- Fix the spelling/variant of the DEX name to the canonical registry entry.
- If the DEX should be supported, register it for the chain in the DEX extended registry.
Example fix
// before nautilusctl blockchain analyze-pool --chain ethereum --dex uni-v2 // after nautilusctl blockchain analyze-pool --chain ethereum --dex uniswap-v2
Defensive patterns
Strategy: validation
Validate before calling
let supported = get_supported_dexes_for_chain(chain.name);
if !supported.iter().any(|d| d.eq_ignore_ascii_case(dex)) {
eprintln!("valid dexes for {}: {}", chain.name, supported.join(", "));
std::process::exit(2);
} Prevention
- Always cross-check the DEX name against the supported list for the specific chain (names differ per chain).
- Rely on case-insensitive matching but not on fuzzy matching; use exact registry names.
- Regenerate scripts after DEX renames instead of reusing old names.
- Catch this anyhow error at the CLI boundary and print the supported list already embedded in the message.
When it happens
Trigger: Running `run_analyze_pool` or `run_analyze_pools` with a DEX name that fails find_dex_type_case_insensitive(dex, chain) while get_supported_dexes_for_chain(chain.name) is non-empty; the join of supported names is included in the message.
Common situations: Misspelling a DEX name ('uniswapv3' vs 'uniswap-v3'); using a DEX that exists on another chain but is not registered on the selected one; stale documentation/scripts referencing a renamed DEX.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Invalid DEX name '{}' (case-insensitive). Chain '{}' is not
- Invalid chain name: {chain}
- Invalid DEX name '{}' (case-insensitive). Chain '{}' is not
- Invalid DEX name '{}' (case-insensitive). Supported DEXes fo
- max_fee_per_contract is required
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/cd573fc6daa0cd70.
Report an issue: GitHub.