nautechsystems/nautilus_trader · error

Invalid DEX name '{}' (case-insensitive). Chain '{}' is not

Error message

Invalid DEX name '{}' (case-insensitive). Chain '{}' is not supported for pool analysis.

What it means

Thrown by parse_chain_dex in the nautilusctl blockchain analyze commands when the --dex argument does not match any DEX registered for the given chain, and the chain itself has no supported DEXes for pool analysis. It is a user-input validation error raised before any network or database work begins.

Source

Thrown at crates/cli/src/blockchain/analyze.rs:509

        .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(", ")
            )
        }
    })?;

    ensure_pool_analysis_supported(chain, dex_type)?;

    Ok((chain.to_owned(), dex_type))
}

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the chain name first: if it is not supported for pool analysis, pick a supported chain via Chain::from_chain_name.
  2. Run the command with a valid DEX name; matching is case-insensitive so fix spelling against the supported list.
  3. Call get_supported_dexes_for_chain(chain.name) or consult CLI help to list valid DEXes for the chain.
  4. Verify the registry (get_dex_extended / supported DEX tables) actually includes the DEX for this chain; if it should, add a registration entry.

Example fix

// before
nautilusctl blockchain analyze-pool --chain base-sepia --dex uniswap-v3
// error: chain not supported
// after
nautilusctl blockchain analyze-pool --chain base --dex uniswap-v3
Defensive patterns

Strategy: validation

Validate before calling

let supported = get_supported_dexes_for_chain(chain.name);
if supported.is_empty() {
    return Err(format!("chain '{}' is not supported for pool analysis", chain.name));
}
if !supported.iter().any(|d| d.eq_ignore_ascii_case(dex)) {
    return Err(format!("dex '{}' not in [{}]", dex, supported.join(", ")));
}

Prevention

When it happens

Trigger: Running `run_analyze_pool` or `run_analyze_pools` with a DEX name that is misspelled, wrongly cased beyond the case-insensitive match, or valid on some other chain but not the selected one, while get_supported_dexes_for_chain(chain.name) returns an empty list (the chain is not supported for pool analysis at all).

Common situations: Typing a DEX alias not in the registry (e.g. 'pancake' instead of 'pancakeswap-v2'); selecting a testnet/custom chain that has no pool-analysis support; copying a command from docs for a different chain.

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


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/4ee1fdc3c8766bf3. Report an issue: GitHub.